Reputation: 1526
I have a navigation controller (navC) and I have a view controller (ViewC) which is a view pushed from root controller. I have hidden back button for ViewC with code:
[[self navigationItem] setHidesBackButton:YES];
I have pushed tab bar controller (tabbarC) after ViewC . In the view controller associated with the first tab in tabbarC I have tried hiding the back button with the code:
[[[self tabBarController] navigationItem] setHidesBackButton:YES];
But the back button is still visible When i click it; it disappears... can any one help me hiding the back button for all the views in the tabbarC.
Upvotes: 4
Views: 3810
Reputation: 31081
In your view just write this line..it will hide back button .. tested
-(void)viewWillAppear:(BOOL)animated
{
[self.navigationItem setHidesBackButton:YES];
}
Upvotes: 0
Reputation: 2807
In your first view that will appear when you push to your tabbarviewcontroller set this
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
self.tabBarController.navigationItem.hidesBackButton=YES;
}
Upvotes: 12
Reputation: 38249
In viewDidLoad of ViewC do this:
[self.navigationController.navigationItem setHidesBackButton:YES];
Also tab selected view controller's viewWillAppear method
[self.navigationController.navigationItem setHidesBackButton:YES];
Upvotes: 0