Pintu
Pintu

Reputation: 369

Disable BackButton when navigation controllers pushed via a tab bar controller

I have a naviation controller. I create a tab bar controller and add 3 sub view on to it. such that I can navigation back to the root view controller.

The problem is that since i have my navigation controllers in the tab bar format., I am not able to disable the back button.

If only one view controller is pushed on to the navigation controller, I am able to disable the back button, but when i push the tab bar controller to the navigation controllr, the back button is not disabled. I want to disable the same and add my own custom button.

Upvotes: 3

Views: 7399

Answers (1)

Jonathan.
Jonathan.

Reputation: 55544

You need to set the navigation item on the tabBarController, rather thannon the view controller. So if you want to disable the back button from a view controller inside a tabBarController which is inside the navigationController you'd use the code:

self.tabBarController.navigationItem.hidesBackButton = NO;

Upvotes: 7

Related Questions