Ios 展开时显示顶栏导航控制器

Ios 展开时显示顶栏导航控制器,ios,uinavigationcontroller,uitabbarcontroller,stack-unwinding,Ios,Uinavigationcontroller,Uitabbarcontroller,Stack Unwinding,目前,我正在使用“展开”来访问其路径的主视图 这是我在Sender ViewController上的代码: - (IBAction)showRecents:(UIStoryboardSegue *)segue { [self.navigationController.tabBarController setSelectedIndex:1]; NSLog(@"Root of Navigation Executed"); } 这是展开前的样子 这是从源代码视图控制器展开后的外观: - (IBAc

目前,我正在使用“展开”来访问其路径的主视图

这是我在Sender ViewController上的代码:

- (IBAction)showRecents:(UIStoryboardSegue *)segue {

[self.navigationController.tabBarController setSelectedIndex:1];
NSLog(@"Root of Navigation Executed");
}
这是展开前的样子

这是从源代码视图控制器展开后的外观:

- (IBAction)showRecents:(UIStoryboardSegue *)segue {

[self.navigationController.tabBarController setSelectedIndex:1];
NSLog(@"Root of Navigation Executed");
}
问题是我不明白为什么它没有显示绿色的顶栏?与TabBarController有关吗

这是我的路径:


这个问题的答案是。首先,我们需要在源ViewController上隐藏/显示NavigationController,在它消失之前,我们需要再次显示它。这样,在Sender ViewController上,您将能够看到导航,因为它被设置为显示在执行展开操作的源上

-(void)viewWillAppear:(BOOL)animated{
[self.navigationController setNavigationBarHidden:YES];
}

-(void)viewWillDisappear:(BOOL)animated{
[self.navigationController setNavigationBarHidden:NO];
}

为什么SourceVC中没有导航栏?你把它设为隐藏了吗?没有,有办法验证吗?验证什么?它看起来像是您从ProfileTableviewController推送到SourceVC,因此应该有一个导航栏,除非您将其设置为隐藏。但是如果它是隐藏的,为什么在展开之前显示它?放松只会让我找到发送方控制器。我的意思是隐藏在SourceVC中,而不是SenderVC中。如果将其设置为在SourceVC中隐藏,则返回时它仍将隐藏。尝试将其设置为不隐藏在SenderVC的ViewWillAspect方法中。