In my viewDidLoad
, I have the below code to hide the back button. However, when implemented, this disables the back button of further View Controllers
in the chain of which I segue to. I'm not sure, but this may be to do with how I structure my app (please see image - note that the Navigation Controller
on the far left is connected to a Tab Bar Controller
).
// Removes back button
self.tabBarController?.navigationItem.hidesBackButton = true
self.tabBarController?.navigationItem.setHidesBackButton(true, animated: false)
self.tabBarController?.navigationItem.leftBarButtonItem = nil
I've also tried the following code, but this didn't work as well.
self.navigationItem.leftBarButtonItem = nil
self.navigationController?.navigationItem.leftBarButtonItem = nil
navigationItem.setLeftBarButton(nil, animated: false)
self.navigationItem.setLeftBarButton(nil, animated: false)
self.tabBarController?.navigationItem.leftBarButtonItem = nil
self.tabBarController?.navigationItem.setLeftBarButton(nil, animated: false)
self.navigationController?.navigationBar.topItem?.leftBarButtonItem = nil