Remove navigation bar from main controller in Xcode?
I have a main view controller in Xcode 6 (program in swift), on which I have several buttons that lead to specific navigation controllers. When I test the app, the first time I see it, it looks fine (no navigation bar at the top). When I click on the button on the main view controller, it displays the navigation controller I selected, everything works fine. The problem occurs when I click on the back button on this nav controller to show me my main controller again. When I go back to the main view controller, there will be a navigation bar at the top that shouldn't be there. I want my main view controller to have no navigation bar at the top. I tried using push, modal and show segues to see if this might be the problem,but I still can't figure it out. Any thoughts on what might happen?
source to share
It looks like you need to hide the navigation bar again. To do this, add:
self.navigationController?.navigationBarHidden = true
in viewWillAppear
any view controller for which you want to hide the navbar.
Updated for Swift 3:
self.navigationController?.isNavigationBarHidden = true
source to share