Instance Method

splitView(_:constrainSplitPosition:ofSubviewAt:)

Allows the delegate for sender to constrain the divider to certain positions.

Declaration

optional func splitView(_ splitView: NSSplitView, constrainSplitPosition proposedPosition: CGFloat, ofSubviewAt dividerIndex: Int) -> CGFloat

Parameters

splitView

The split view that sent the message.

proposedPosition

The cursor’s current position, and the proposed position of the divider.

dividerIndex

Specifies the divider the user is moving, with the first divider being 0 and increasing from top to bottom (or left to right).

Return Value

The position at which to constrain the divider.

Discussion

If the delegate implements this method, the split view calls it repeatedly as the user moves the divider.

For example, if a subview’s height must be a multiple of a certain number, use this method to return the multiple nearest to proposedPosition.

See Also

Constraining Split Position

func splitView(NSSplitView, constrainMaxCoordinate: CGFloat, ofSubviewAt: Int) -> CGFloat

Allows the delegate for sender to constrain the maximum coordinate limit of a divider when the user drags it.

func splitView(NSSplitView, constrainMinCoordinate: CGFloat, ofSubviewAt: Int) -> CGFloat

Allows the delegate for sender to constrain the minimum coordinate limit of a divider when the user drags it.