Set Navbar hidden = false doesn't work
I have 2 ViewController
VC A and VC B
VC A => NavigationBar Hidden = true
VC B => NavigationBar Hidden = false
I am doing a segue from A => B but the navigation bar in VC B is not visible.
I have the following quick code in vc b:
override func viewWillAppear(animated: Bool) {
self.navigationController?.navigationBarHidden = false
}
Any ideas?
+3
source to share
5 answers
The navigation bar and toolbar should disappear in the storyboard when you change the segue - this is normal.
Try to check
The following should work with iOS 8 for a specific look
override func viewWillAppear(animated: Bool)
{
self.navigationController?.navigationBarHidden = false
}
To show on all viewControllers place it in viewDidLoad
self.navigationController?.navigationBarHidden = false
0
source to share
Do it like this:
In your VC A use this code:
override func viewDidLoad() {
super.viewDidLoad()
navigationController?.setNavigationBarHidden(true, animated: true)
}
And in VC B use this code:
override func viewDidLoad() {
super.viewDidLoad()
navigationController?.setNavigationBarHidden(false, animated: true)
}
0
source to share
VC A and VC B are embedded in the navigation controller here and it works for me.
In VC A, I have the following code:
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(true)
navigationController?.setNavigationBarHidden(false, animated: true)
}
and in B i
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(true)
navigationController?.setNavigationBarHidden(true, animated: true)
}
works great
0
source to share