SwiftyJD SwiftyJD - 11 months ago 57
Swift Question

In Swift, I have 2 navigation bars but want to hide one of them, how to do it?

I currently have a viewcontroller that has two navigation bars because Its has a navigation controller both before and after a tab bar controller. I tried to have it so that the viewcontroller before the tab bar controller will present modally but by dong so the 2nd nav bar didn't work properly. The 2nd nav bar is a custom side menu that only appears to work if the first navigation controller is preset. Here is a pic


Is there a way so that only the bottom nav controller is visible?


If I understand your question correctly, you want to hide the ui for the enclosing navigation controller - i.e. the nav bar. You can do that by setting it hidden in the viewDidLoad() function of that view controller:

override func viewDidLoad() {

    navigationController?.setNavigationBarHidden(true, animated: false)