I have rootViewController with NavigationController. On the rootView navigationBar is hidden. When I pushes next view navBar is showed. So when I go back from second view to rootView navBar hides. It’s okay. Then I want to go from second view to the third view and show the navBar. But it is hidden, because in second view I have this code to hide navBar in rootView when goes to it from second view:
-(void)viewWillDisappear:(BOOL)animated{
[super viewWilDisappear:animated];
[self.navigationcontroller setNavigationBarHidden:YES animated:YES];
}
How to show the navBar only on the rootView and hide it on all other views??
Second view is subclass of UIViewController, third view is subclass of UIViewController too with UITableView created by IB.
UPD
In first viewController I’ve added this:
-(void)viewDidLoad{
[self.navigationController setNavigationBarHidden:YES];
[super viewDidLoad];
}
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:YES animated:YES];
}
-(void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
[self.navigationController setNavigationBarHidden:NO animated:YES];
}
And in THIRD this:
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:NO animated:YES];
}
Thanks for help, guys!!
in third view’s viewWillAppear add this: