这里是我的一段代码,但这样,当我推动第三级视图控制器时,tabbar不会显示。UINavigationController,如何在第二级viewController中隐藏tabbar然后在第三级viewController中显示tabbar
//at first level
SecondLevelViewController *_2vc = [[SecondLevelViewController alloc]initWithNibName:@"SecondLevelViewController" bundle:nil];
_2vc.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:_2vc animated:YES];
//at second level
ThirdLevelViewController *_3vc = [[ThirdLevelViewController alloc]initWithNibName:@"ThirdLevelViewController" bundle:nil];
_3vc.hidesBottomBarWhenPushed = NO;
[self.navigationController pushViewController:_3vc animated:YES];
它的工作原理。但我不知道为什么在推动第三级视图控制器时将hidesBottomBarWhenPushed属性设置为NO不起作用? –
我假设hidesBottomBarWhenPushed是一个布尔变量不?如果它只是一个布尔变量,你不能指望它自己隐藏/显示视图。您需要在您的视图控制器中的某处实现隐藏/显示代码。在这个例子中,我在viewWillAppear方法中设置了隐藏/显示代码。 –