Storyboard - Hiding top bar of navigation controller programmatically Storyboard - Hiding top bar of navigation controller programmatically ios ios

Storyboard - Hiding top bar of navigation controller programmatically


Finally solved it. You should always hide navigation bar only through viewController.

In my question above I instantiated a whole new navigationController which didn't point at the real navController on the screen. You can obtain the "real" one through the view controller like this:

[viewController.navigationController setNavigationBarHidden:YES animated:YES];


There are 2 ways to hide top bar of Navigation Controller:

1) Programatically

[self.navigationController setNavigationBarHidden:YES animated:YES];

2) Using Interface Builder

You can uncheck "Shows Navigation Bar" in property list of Navigation Controller.

enter image description here

Please make sure you have selected scene which contain Navigation Controller. Example image of scene.
enter image description here


in swift 4:

self.navigationController!.navigationBar.isHidden = true

something like this:

override func viewDidLoad() {        super.viewDidLoad()       self.navigationController!.navigationBar.isHidden = true    }


matomo