假设,我正在讨论 View Controller 并且我搜索了一些东西。现在我切换了选项卡,现在我又回到了这个讨论 View Controller ,然后导航栏被隐藏了,这是我不想要的。我尝试了所有方法,例如 hidesNavigationBarDuringPresentation 或导航项的 setHidden 属性,但没有任何反应。
最佳答案
试试这个
if your current viewcontroller is already embed with Navigation controller, the following code will work
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[[self navigationController] setNavigationBarHidden:NO animated:YES];
}
注意
Present viewcontroller does not embed with
UINavigationcontroller
, if you want we need to add in manual, see this link once
关于ios - SearchController 不显示导航栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35725218/