Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift: how to detect if UISplitViewController is currently showing 1 or 2 controllers?

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?

like image 527
Daniele B Avatar asked Nov 15 '15 14:11

Daniele B


1 Answers

The split view controller reflects the actual display mode in the displayMode property:

AllVisible: The primary and secondary UIViewControllers are displayed side-by-side.

PrimaryHidden: The primary UISplitViewController is hidden.

PrimaryOverlay: The primary UISplitViewController overlays the secondary, which is partially visible.

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.


Resume: To find out the detailed situation on screen use isCollapsed property and (if isCollapsed = false) displayMode property.

like image 166
OrdoDei Avatar answered Nov 08 '22 12:11

OrdoDei