【问题标题】:Display TopBar NavigationController when unwinding展开时显示 TopBar NavigationController
【发布时间】:2014-07-18 17:36:43
【问题描述】:

目前我正在使用 Unwind 进入其路径的主视图。

这是我在 Sender ViewController 上的代码:

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

[self.navigationController.tabBarController setSelectedIndex:1];
NSLog(@"Root of Navigation Executed");
}

这是展开前的样子

这是从源视图控制器展开后的样子:

问题是我不明白为什么它没有显示绿色顶栏?和 TabBarController 有关系吗?

这是我的路径 VC:

【问题讨论】:

  • 为什么SourceVC没有导航栏?你把它设置为隐藏在那里吗?
  • 不,有办法验证吗?
  • 验证什么?看起来你是从 ProfileTableviewController 推送到 SourceVC 的,所以应该有一个导航栏,除非你把它设置为隐藏。
  • 但如果它隐藏了,为什么它会在展开前显示? Unwind 只是将我带到 Sender Controller。
  • 我的意思是隐藏在 SourceVC 中,而不是 SenderVC。如果你在 SourceVC 中设置为隐藏,那么返回时它仍然是隐藏的。尝试将其设置为不隐藏在 SenderVC 的 viewWillAppear 方法中。

标签: ios uinavigationcontroller uitabbarcontroller stack-unwinding


【解决方案1】:

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

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-11-26
    • 1970-01-01
    • 1970-01-01
    • 2016-03-27
    • 2018-04-08
    • 1970-01-01
    • 2011-05-08
    • 1970-01-01
    相关资源
    最近更新 更多