Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIViewController pushViewController, show navigationBar

I have UIViewController(1) without navigationBar, and I need to push anouther UIViewController(2) that have navigationBar, and when I click Back on it, navigationBar must hide on 1 controller. I have tried uiviewcontroller delegates. But nothing is working..

Please help..

like image 784
LightNight Avatar asked Dec 11 '22 23:12

LightNight


1 Answers

This will show the navbar on the second screen:

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];        
    self.navigationController.navigationBarHidden = NO;
}

You will also need to hide the navbar when you return to the first screen:

- (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];        
    self.navigationController.navigationBarHidden = YES;
}
like image 82
ader Avatar answered Jan 08 '23 20:01

ader