在起始页面上隐藏UINavigationController [英] Hiding a UINavigationController on start page
问题描述
我有一个NavigationController,它以一个viewController开头,其中viewDidLoad中具有:
Hi I have a navigationController that starts with a view controller in which in viewDidLoad has:
self.navigationController.navigationBarHidden = YES;
我单击该页面上的一个按钮,它过渡到我放入的第二个视图控制器:
I click a button on that page and it transitions to a second view controller in which I put:
self.navigationController.navigationBarHidden = NO;
在我单击导航栏中的上一步"按钮之前,此方法工作正常.如何将导航栏永久保持在起始页面之外,而不是保持过渡页面呢?
This works fine until I click the Back button in the navigation bar. How do I keep the navigation bar permanently off the start page but not the transitioned one?
推荐答案
在firstViewController的viewWillAppear中添加 self.navigationController.navigationBarHidden = YES;
.
Add self.navigationController.navigationBarHidden = YES;
in the viewWillAppear of the firstViewController.
您正在在viewDidLoad方法中添加隐藏操作,该方法将被调用一次,因为当您按下nextViewController时,导航堆栈中的viewController不会被卸载.
You are adding hidden action in the viewDidLoad method which is called once as the viewControllers in navigation stack are not unloaded when your push to the nextViewController.
这篇关于在起始页面上隐藏UINavigationController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!