Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hide back button when tab bar controller is added in navigation controller

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.

like image 642
Saraswati Avatar asked Dec 15 '22 19:12

Saraswati


1 Answers

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;
}
like image 75
Neo Avatar answered Feb 09 '23 01:02

Neo