问题描述
请帮我在根视图中隐藏导航控制器.我找到了在所需的每个视图控制器中写入[navigationController setNavigationBarHidden:YES]
的解决方案.好吧,它只能在第一次使用:我运行应用程序,在根视图中没有导航,然后转到第二个视图–导航出现,确定.但是,然后我在导航控制器中按了返回",并且从根视图进行的导航还没有消失.我在xib上工作.
Please, help me to hide navigation controller in root view. I've found the solution to write [navigationController setNavigationBarHidden:YES]
in every view controller which I need. Well, it works but only for the first time: I run application, in root view I don't have navigation, then I go to the second view – the navigation appears, OK. But then I press "Back" in navigation controller, and navigation from root view hasn't disappear. I work with xib.
推荐答案
在rootViewController中
In rootViewController
-(void)viewWillAppear:(BOOL)animated
{
[self.navigationController setNavigationBarHidden:YES animated:NO];
}
在第二个视图中(在rootViewController旁边)
In second View(next to rootViewController)
-(void)viewDidLoad:(BOOL)animated
{
[self.navigationController setNavigationBarHidden:NO animated:NO];
}
这篇关于如何在根视图中隐藏导航控制器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!