A split view controller manages an array of adjacent child views, and has a split view object for managing dividers between those views.
- macOS 10.10+
The complete object architecture of a split view controller is a bit more complex. Specifically, a split view controller owns an array of split view items (of type
NSSplit), each of which has a view controller (of type
NSView) and corresponding view. The child views and the dividers are all contained within the split view controller’s own view.
The split view controller serves as the delegate of its split view object (the object that manages the dividers). If you override a split view delegate method, your override must call
By default, child views are arranged vertically, from top to bottom in the split view controller’s view. To specify horizontal (side-by-side) arrangement, implement the
vertical property of the split view controller’s
split object to return
true specifies vertical dividers and, consequently, horizontal view arrangement).
To use a split view controller, you must use Auto Layout for the child views and to support animations that collapse and reveal child views. For example, if you design a layout containing two views, a content area and an optional sidebar, you would employ Auto Layout constraints to specify whether the content area shrinks or remains the same size when the sidebar becomes visible.
A split view controller employs lazy loading of its views. For example, adding a collapsed split view item as a new child does not load the associated view until it is revealed.