navigationBar of UINavigationController dissappears
I have this:
FirstViewController:
SecondViewController *secondViewController = [[SecondViewController alloc] init];
[self.navigationController pushViewController:secondViewController animated:YES]开发者_运维百科;
SecondViewController:
- (void)viewDidLoad
{
[super viewDidLoad];
[self.navigationController setNavigationBarHidden:YES];
}
My problem is that when I comeback from SecondViewController to FirstViewController the NavigationBar is still hidden.Is there a way to make it appear when I'm back in FirstViewController?
In the FirstViewController.m
:
-(void)viewWillAppear:(BOOL)animated
{
[self.navigationController setNavigationBarHidden:NO];
}
Yep, it's always possible that a different navigation controller will have set the bar to be hidden. So, in your viewWillAppear
set the flag as follows:
self.navigationController.navigationBarHidden = NO;
You need to set [self.navigationController setNavigationBarHidden:NO]; This will do.
精彩评论