JVS JVS - 6 months ago 20
Swift Question

Back Bar Button Segue hides Toolbar

I am using a

Show
segue in my application.
Whenever I segue to another screen and press the back bar button, my
navigationController.toolbar
disappears.

I tried to get rid of it with

navigationController?.toolbar.hidden = false


in my
viewDidLoad()
.
It doesn't work though. Any ideas?

Answer

Please add the code in the viewWillAppear() and it should solve the problem you are facing.

 override func viewWillAppear(animated: Bool) {
    super.viewWillAppear(animated)
    navigationController?.toolbarHidden = false

}

Remember that viewDidLoad() fires only once during the life cycle of a view controller and in your case , it is in the navigation stack which means it has been already used for that view controller and now when you press back button, it does not work again.

Comments