简体   繁体   English

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

[英]Changing Detail's Navigation Bar in UISplitViewController in Portrait mode

I have a UISplitViewController in which MasterViewController and DetailViewController has its own navigation controller.我有一个UISplitViewController ,其中MasterViewControllerDetailViewController有自己的导航控制器。

This is my storyboard:这是我的故事板:

UISplitViewController 的当前故事板

When MasterViewController and DetailViewController are both visible (iPhone 6+ Landscape and iPad):MasterViewControllerDetailViewController都可见时(iPhone 6+ Landscape 和 iPad):

DetailViewController uses Detail Navigation Controller . DetailViewController使用Detail Navigation Controller Everything is perfect in here.这里的一切都很完美。

When only DetailViewController is visible (iPhone 6+ Portrait and all other iPhones both Landscape and Portrait):当只有DetailViewController可见时(iPhone 6+ 纵向和所有其他 iPhone 横向和纵​​向):

DetailViewController still uses Detail Navigation Controller ( self.navigationController returns Detail Navigation Controller ). DetailViewController仍然使用Detail Navigation Controllerself.navigationController返回Detail Navigation Controller )。 But on top, Master Navigation Controller 's navigation bar is visible, instead of Detail Navigation Controller 's navigation bar.但最重要的是, Master Navigation Controller的导航栏是可见的,而不是Detail Navigation Controller的导航栏。

I want to use same navigation bar for DetailViewController for every device size in both portrait and landscape mode.我想在纵向和横向模式下为每个设备尺寸使用相同的DetailViewController导航栏。 (Styling for master's navigation bar and detail's navigation bar is different.) (master 导航栏和detail 导航栏的样式不同。)

Is there a way to do this without declaring a hacky computed property named currentlyVisibleNavigationController or keeping references between ViewControllers?有没有办法做到这一点不宣名为哈克计算财产currentlyVisibleNavigationController或ViewControllers之间保持引用?

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在UISplitViewController iOS 8中更改细节导航项 - Changing the detail Navigation Items in UISplitViewController iOS 8 从UISplitViewController的详细信息视图更改BadgeValue - Changing the BadgeValue from a UISplitViewController 's detail view 导航栏标题未在iPhone的纵向模式下居中 - Navigation bar title is not centred in iPhone's portrait mode UISplitViewController在横向模式下显示为纵向 - UISplitViewController appears portrait in landscape mode 在推送细节导航的同时设置UISplitViewController的preferredDisplayMode - Setting UISplitViewController's preferredDisplayMode whilst pushing onto detail navigation UISplitViewController仅在纵向视图中获取详细信息VC - UISplitViewController Getting Detail VC Only in Portrait View UISplitViewController - 以纵向模式打开,masterViewController可见 - UISplitViewController - open in portrait mode with masterViewController visible 在纵向模式下按下新视图控制器后,iOS UISplitViewController的Popover控制器按钮消失 - iOS UISplitViewController's Popover controller button disappear after pushing new view controller in portrait mode iOS导航栏更改高度风景与肖像 - iOS navigation bar changing height landscape vs portrait UISplitViewController在iPhone上的肖像显示详细VC而不是主 - UISplitViewController in portrait on iPhone shows detail VC instead of master
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM