关于隐藏UITabBarController和UINavigationController
Posted on 2012-10-12 16:48 billpeng 阅读(5212) 评论(0) 编辑 收藏 举报隐藏UINavigationController:
比如A页面要隐藏UINavigationController
-(void)viewWillAppear:(BOOL)animated{
[self.navigationController setNavigationBarHidden:YES animated:YES];
}
- (void)viewDidLoad
{
[self.navigationController setNavigationBarHidden:YES animated:NO];
}
[self.navigationController setNavigationBarHidden:YES animated:YES];
}
- (void)viewDidLoad
{
[self.navigationController setNavigationBarHidden:YES animated:NO];
}
这两处都要加,如果viewdidload不加的话,会有一个明显的隐藏动画不美观。
如果B页面需要显示UINavigationController,就需要在B页面的viewDidload或viewWillAppear中加入:[self.navigationController setNavigationBarHidden:NO animated:YES];
---------------------------------------
如果要C页面中隐藏UITabBarController
CPage *c = [[CPage alloc]init];
c.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:c animated:YES];
c.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:c animated:YES];