Tabbar
- 首页显示tabbar,push其他页面后隐藏tabbar
ToViewController.hidesBottomBarWhenPushed=YES;
presentViewController时隐藏tabbar
UIViewController *presentedVC = [[UIViewController alloc]init];
presentedVC.modalPresentationStyle = UIModalPresentationOverCurrentContext;
AppDelegate *appdelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
appdelegate.window.rootViewController.definesPresentationContext = YES;
[appdelegate.window.rootViewController presentViewController:presentedVC animated:YES completion:nil];
UINavigationController
- 根控制器隐藏NavigationBar,其他页面不隐藏或者部分隐藏NavigationBar
#pragma mark --- UINavigationControllerDelegate
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
if (![viewController isKindOfClass:[self class]]) {
[navigationController setNavigationBarHidden:NO animated:animated];
}
}
- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
if ([viewController isKindOfClass:[self class]]) {
[navigationController setNavigationBarHidden:YES animated:animated];
}
}
网友评论