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


if you use

self.navigationController?.navigationBar.hidden = true;

      

use this to show Bar

self.navigationController?.navigationBar.hidden = false;

      



do not use

self.navigationController?.navigationBarHidden = false;

      

check that

+3


source


The navigation bar and toolbar should disappear in the storyboard when you change the segue - this is normal.

Try to check enter image description here

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


You can do the following job

in your VC A viewWillDisappear

override func viewWillDisappear(animated: Bool) {
        self.navigationController?.navigationBarHidden = false

    } 

      

0


source


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


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







All Articles