【问题标题】:Why the navigation header is hidden in ios13?为什么导航标题隐藏在ios13中?
【发布时间】:2019-11-11 05:58:22
【问题描述】:

当我使用 PushViewController 添加导航标题时,此代码仍然可见:

View viewp = new View();
NavigationController.PushViewController(viewp, false);

但是当我使用 PresentViewControllerAsync 添加时,导航标题被隐藏了,这是怎么回事?

viewp.ModalPresentationStyle = UIModalPresentationStyle.FullScreen;
this.PresentViewController(viewp, true, null);  

我正在使用 ios13,我怎么了? 左右按钮不显示

【问题讨论】:

  • 您可以分享两张截图以显示它们之间的差异,这将有助于了解这是否是 iOS 13 中的问题。
  • @JuniorJiang-MSFT 左右按钮不显示
  • 好的,感谢更新问题。如果左右按钮在导航栏中,使用PresentViewController时不会显示。看看我的答案。
  • 如果回答对您有帮助,请记得稍后有时间标记ot投票。提前谢谢*.^

标签: c# xamarin xamarin.ios


【解决方案1】:

他们没有任何问题,这是正常现象。

  • PushViewController需要Root View Controller为NavigationController,只能在NavigationController中使用。因此,调用时需要如下:

    NavigationController.PushViewController(xxx)

这也是这个方法可以看到Navigation Bar的原因。下一页在 Navigation Controller 下。看看UINavigationControllerpushViewController:animated: 的定义:

  • 但是,无论根视图控制器是 NavigationController 还是其他控制器,都可以调用 PresentViewController。它只是在对话框控制器的窗口中显示一个视图控制器。然后在下一个视图中不会显示导航栏,因为它不在导航控制器堆栈的堆栈下。

这里有一些关于它们之间区别的很好的讨论供参考。

Difference between pushViewController and showViewController

difference between presentViewController and UINavigationController?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-06-09
    • 2017-11-25
    • 1970-01-01
    • 2021-01-09
    • 2021-11-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多