Class

NSSplitView

A view that arranges two or more views in a linear stack running horizontally or vertically.

Overview

A split view manages the dividers and orientation for a split view controller (an instance of the NSSplitViewController class.) By default, dividers are oriented horizontally so that sibling views are arranged vertically, from top to bottom, in the containing split view controller.

Divider indices are zero-based, with the leftmost or topmost divider (depending on the value of the isVertical property) having an index of 0.

Topics

Customizing the Split View Behavior

var delegate: NSSplitViewDelegate?

The split view’s delegate.

protocol NSSplitViewDelegate

The NSSplitViewDelegate protocol defines the optional methods implemented by delegates of NSSplitView objects.

Managing Split Items

class NSSplitViewItem

An item in a split view controller.

Managing Subviews

func adjustSubviews()

Adjusts the sizes of the split view’s subviews so they (plus the dividers) fill the split view.

func isSubviewCollapsed(NSView)

Returns whether the specified view is collapsed.

func holdingPriorityForSubview(at: Int)

Returns the priority of the subview’s width or height when resizing.

func setHoldingPriority(NSLayoutConstraint.Priority, forSubviewAt: Int)

Sets the priority under which split view subviews maintain their width or height.

Managing Divider Orientation

var isVertical: Bool

The geometric orientation of the split view's dividers, where YES results in vertical dividers and side-by-side views.

Configuring and Drawing Dividers

var dividerStyle: NSSplitView.DividerStyle

The style of divider drawn between views.

var dividerColor: NSColor

The color of the dividers that the split view draws between subviews.

var dividerThickness: CGFloat

The thickness of the dividers for the split view.

func drawDivider(in: NSRect)

Draws a divider between two of the receiver’s subviews.

Saving Subview Positions

var autosaveName: NSSplitView.AutosaveName?

The name under which split view’s divider configuration is automatically saved.

Constraining Split Position

func minPossiblePositionOfDivider(at: Int)

Returns the minimum possible position of the divider at the specified index.

func maxPossiblePositionOfDivider(at: Int)

Returns the maximum possible position of the divider at the specified index.

func setPosition(CGFloat, ofDividerAt: Int)

Sets the position of the divider at the specified index.

Constants

enum NSSplitView.DividerStyle

These constants specify the possible divider styles used by NSSplitView and NSSplitView.

Notifications

NSSplitView declares and posts the following notifications. In addition, it posts notifications declared by its superclass, NSView. See the NSView class specification for more information.

class let didResizeSubviewsNotification: NSNotification.Name

Posted after an NSSplitView changes the sizes of some or all of its subviews.

class let willResizeSubviewsNotification: NSNotification.Name

Posted before an NSSplitView changes the sizes of some or all of its subviews.

Relationships

Inherits From

See Also

Split View Interface

class NSSplitViewController

An object that manages an array of adjacent child views, and has a split view object for managing dividers between those views.

class NSSplitViewItem

An item in a split view controller.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software