gpt4 book ai didi

ios - 在纵向模式下更改 UISplitViewController 中详细信息的导航栏

转载 作者:行者123 更新时间:2023-12-03 18:33:17 25 4
gpt4 key购买 nike

我有一个 UISplitViewController,其中 MasterViewControllerDetailViewController 有自己的导航 Controller 。

这是我的 Storyboard:

Current Storyboard for UISplitViewController

MasterViewControllerDetailViewController 均可见时(iPhone 6+ 横向和 iPad):

DetailViewController 使用详细导航 Controller 。这里的一切都很完美。

当仅 DetailViewController 可见时(iPhone 6+ 纵向和所有其他 iPhone 横向和纵​​向):

DetailViewController 仍然使用详细导航 Controller (self.navigationController 返回详细导航 Controller )。但在顶部,主导航 Controller 的导航栏是可见的,而不是详细导航 Controller 的导航栏。

我想对纵向和横向模式下的每种设备尺寸使用相同的 DetailViewController 导航栏。 (主控导航栏和详细导航栏的样式不同。)

有没有办法做到这一点,而无需声明名为 currentlyVisibleNavigationController 的黑客计算属性或保留 ViewController 之间的引用?

最佳答案

要在 UISplitViewController 上下文中获取详细 Controller 的当前 UINavigationBar 对象,您可以尝试以下操作:

let navigationBar = navigationController?.navigationController?.navigationBar ?? navigationController?.navigationBar

关于ios - 在纵向模式下更改 UISplitViewController 中详细信息的导航栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38995514/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com