Search code examples
iosswiftuinavigationcontrollernavigationbar

Completely disable the Navigation Controller


I have used the 'Embed In' navigation controller within the storyboard. Is there a way to completely disable the whole navigation bar? I have tried the code below, but when there is a swipe, the navigation bar appears again. I want to be able to completely hide the whole bar until a condition is met. Is there a way to do this?

  self.navigationController?.hidesBarsOnSwipe = true
  self.navigationController?.hidesBarsOnTap = true

I have tried a custom navigation bar, but I couldn't get a nice scroll effect like with the default navigation bar.


Solution

  • To hide the navigationBar just do:

    self.navigationController?.navigationBar.isHidden = true
    

    Add this row in your viewDidLoad.