UINavigationController without navigation bar?
In Xcode 4.3.2:
- Select the navigation controller in the storyboard
- Select the Attributes Inspector in the (right) Utilities panel
Under the Navigation Controller category you have two check boxes:
[] Shows Navigation Bar
[] Shows Toolbar
Worked for me...
You should be able to do the following:
self.navigationController.navigationBar.isHidden = true //Swift 5
where self.navigationController is (obviously) an instance of UINavigationController. Seems to work for me, but I only briefly tested it before posting this.
If you want no navigation bar, and you want the content to be adjusted up to where the navigation bar normally would be, you should use
self.navigationController.navigationBarHidden = YES;
This gives you a result like this:
Whereas self.navigationController.navigationBar.hidden = YES;
gives you a space where the navigationBar should be. Like this:
Swift 4
I hide it in viewWillAppear
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.navigationController?.isNavigationBarHidden = true;
}
Then you can put it back when you push a segue (if you want to have the back button on the next view)
override func prepare(for segue: UIStoryboardSegue, sender: Any?)
{
self.navigationController?.isNavigationBarHidden = false;
}