ONE controller with TWO navigation bars

£可爱£侵袭症+ 提交于 2019-12-13 04:30:50

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!