Ios 导航栏赢了';隐藏
我正在试图找出为什么我不能在自定义模式导航控制器中隐藏导航栏。我尝试添加以下行:Ios 导航栏赢了';隐藏,ios,xcode,uinavigationbar,Ios,Xcode,Uinavigationbar,我正在试图找出为什么我不能在自定义模式导航控制器中隐藏导航栏。我尝试添加以下行: self.navigationController.navigationBarHidden = YES; 我已经把它放在viewdidload中,初始值设定项,但它不会隐藏条。以下是我的自定义模式代码: -(void)launchCustomModal:(id)sender{ UIButton *buttonClicked = (UIButton *)sender; int selection;
self.navigationController.navigationBarHidden = YES;
我已经把它放在viewdidload中,初始值设定项,但它不会隐藏条。以下是我的自定义模式代码:
-(void)launchCustomModal:(id)sender{
UIButton *buttonClicked = (UIButton *)sender;
int selection;
selection = buttonClicked.tag;
if (selection == 1) {
modalViewController = [[UINavigationController alloc]initWithRootViewController:[[artistsViewController alloc]initWithNibName:nil bundle:nil]];
}
SDJAppDelegate *app = (SDJAppDelegate *) [UIApplication sharedApplication].delegate;
UIWindow *appWindow = [app window];
UIView *windowView = [[appWindow subviews] objectAtIndex:0];
CGRect rect = [[UIScreen mainScreen] applicationFrame];
syncView = [[UIView alloc]initWithFrame: rect];
CGRect frame = syncView.frame;
frame.origin.y = -20.0;
syncView.frame = frame;
CATransition *animation = [CATransition animation];
[animation setDelegate:self];
[animation setType:kCATransitionMoveIn];
[animation setSubtype:kCATransitionFromBottom];
[animation setDuration:0.50];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[[syncView layer] addAnimation:animation forKey:kCATransition];
[windowView addSubview:syncView];
[syncView addSubview:modalViewController.view];
[modalViewController viewDidLoad];
}
有人有什么想法吗???这是什么样的视图控制器?UIViewController、UINavigationController等?找到了答案:我在接口文件中将modalViewController定义为UIViewController-现在它可以工作了,将它切换到UINavigationController。谢谢没问题。很高兴你明白了。