基本框架是用的UITabBarController+UINavigationController,在AppDelegate中添加了四个tab页
在tab页中,点击跳转二级页面是,设置隐藏导航栏,确始终会显示,不知道是哪里错了,有大佬能指点一二吗
AppDelegate中初始化代码:
HomeVC *homeVC = [[HomeVC alloc] init];
FindVC *findVC = [[FindVC alloc] init];
WorkRoomVC *workVC = [[WorkRoomVC alloc] init];
MineVC *mineVC = [[MineVC alloc] init];
UINavigationController *navHome = [[UINavigationController alloc]initWithRootViewController:homeVC];
UINavigationController *navFind = [[UINavigationController alloc]initWithRootViewController:findVC];
UINavigationController *navWork = [[UINavigationController alloc]initWithRootViewController:workVC];
UINavigationController *navMine = [[UINavigationController alloc]initWithRootViewController:mineVC];
UITabBarController *tabBar = [[UITabBarController alloc] init];
[tabBar addChildViewController:navHome];
[tabBar addChildViewController:navFind];
[tabBar addChildViewController:navWork];
[tabBar addChildViewController:navMine];
tabBar.tabBar.translucent = NO;
tabBar.delegate = self;
self.window.rootViewController = tabBar;
在HomeVC中点击跳转:
SearchVC *vc = [[SearchVC alloc] init];
vc.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:vc animated:YES];
SearchVC中设置不显示导航栏:
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
self.navigationController.navigationBarHidden = YES;
[self.navigationController setNavigationBarHidden:YES];
}