关于UINavigationController、Tabbar

Tabbar

  1. 首页显示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

  1. 根控制器隐藏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];
    }
}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容