问题
I'm using 2 UINavigationControllers, all is fine, except that when I return to a previous controller in the other UINavigationController I have its navigation bar + the navigation bar of the previous controller, example:
Navigation Controller1 => A controller => B controller => Navigation Controller2=> C controller.
When I segue from C controller to A controller I have the navigation bar of both Navigation Controller1 and 2. I tried to make that when I leave C controller:
-(void)viewDidDisappear:(BOOL)animated{
[super viewDidDisappear:(BOOL)animated];
NSLog(@"Disappeared!");
[self.navigationController setNavigationBarHidden:YES];
}
But I always have the same problem. Any hints, ideas? Thank you for your help.
回答1:
I'm seriously doubting your need for two navigation controllers, but if you think you do, you can hide one controller's navigation bar by calling setNavigationBarHidden:animated: on self.navigationController in the appropriate view controller.
回答2:
Why are you pushing UINavigationControllers within each other? It's not a good iOS Programming practice. You can present second Nav Controller as modal controller on 1st Nav. controller, and dismiss it when you have done your task.
来源:https://stackoverflow.com/questions/17549509/one-controller-with-two-navigation-bars