navigationController?.setNavigationBarHidden(true, animated: true)
When you press back button, your view controller
viewDidLoad method is not called again (because controller is not recreated) and navigation bar will have the same state as it had before you went back.
In order to update navigation bar for each view controller as it is shown, you have to update it in
viewWillAppear method instead of