Swift:如何检测UISplitViewController当前是否显示1或2个控制器? [英] Swift: how to detect if UISplitViewController is currently showing 1 or 2 controllers?
问题描述
如何检测 UISplitViewController
目前是否只显示 1个视图控制器,或者它是否位于带有 2个视图控制器的双窗格中并排显示?
How can I detect if the UISplitViewController
is currently just showing 1 view controller or it's in dual-pane with 2 views controllers shown side-by-side?
推荐答案
拆分视图控制器反映 displayMode 属性:
The split view controller reflects the actual display mode in the displayMode property:
AllVisible :主要和辅助UIViewControllers并排显示。
AllVisible: The primary and secondary UIViewControllers are displayed side-by-side.
PrimaryHidden :主要的UISplitViewController是隐藏。
PrimaryHidden: The primary UISplitViewController is hidden.
PrimaryOverlay :主UISplitViewController覆盖辅助设备,部分可见。
PrimaryOverlay: The primary UISplitViewController overlays the secondary, which is partially visible.
当 isCollapsed 属性为 true 时,将忽略 displayMode 属性的值。折叠拆分视图界面包含仅一个视图控制器,因此显示模式是多余的。
When the isCollapsed property is true, the value of displayMode property is ignored. A collapsed split view interface contains only one view controller so the display mode is superfluous.
恢复:要了解屏幕上的详细情况,请使用 isCollapsed 属性和(如果 isCollapsed = false ) displayMode 属性。
Resume: To find out the detailed situation on screen use isCollapsed property and (if isCollapsed = false) displayMode property.
这篇关于Swift:如何检测UISplitViewController当前是否显示1或2个控制器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!