| Conforms to | |
| Framework | /System/Library/Frameworks/AppKit.framework |
| Availability | Available in Mac OS X v10.6 and later. |
| Declared in | NSSplitView.h |
| Companion guides |
The NSSplitViewDelegate protocol defines the optional methods implemented by delegates of NSSplitView objects.
– splitView:resizeSubviewsWithOldSize:
– splitViewWillResizeSubviews:
– splitViewDidResizeSubviews:
– splitView:canCollapseSubview:
– splitView:shouldCollapseSubview:forDoubleClickOnDividerAtIndex:
– splitView:shouldAdjustSizeOfSubview:
– splitView:effectiveRect:forDrawnRect:ofDividerAtIndex:
– splitView:shouldHideDividerAtIndex:
– splitView:additionalEffectiveRectOfDividerAtIndex:
Allows the delegate to return an additional rectangle in which mouse clicks will initiate divider dragging.
- (NSRect)splitView:(NSSplitView *)splitView additionalEffectiveRectOfDividerAtIndex:(NSInteger)dividerIndex
The split view that sent the message.
The index of the divider.
An additional rectangle in which mouse clicks should initiate divider dragging. The rectangle should be expressed in the coordinate system defined by splitView. Returning NSZeroRect indicates no additional dragging rectangle is desired.
If a split view has no delegate, or if its delegate does not respond to this message, only mouse clicks within the effective frame of a divider initiate divider dragging.
NSSplitView.hAllows the delegate to determine whether the user can collapse and uncollapse subview.
- (BOOL)splitView:(NSSplitView *)splitView canCollapseSubview:(NSView *)subview
The split view that sent the message.
The subview to collapse.
YES if subview should collapse when the user drags a divider beyond the halfway mark between its minimum size and its edge, otherwise NO.
The subview uncollapses when the user drags the divider back beyond the halfway mark between its minimum size and its edge.
To specify the minimum size, define the methods splitView:constrainMaxCoordinate:ofSubviewAt: and splitView:constrainMinCoordinate:ofSubviewAt:. A subview can collapse only if you also define splitView:constrainMinCoordinate:ofSubviewAt:.
A collapsed subview is hidden but retained by the split view object, with the same size it had before it was collapsed.
If the delegate does not implement this method the subviews can’t be collapsed.
NSSplitView.hAllows the delegate for sender to constrain the maximum coordinate limit of a divider when the user drags it.
- (CGFloat)splitView:(NSSplitView *)splitView constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)dividerIndex
The split view that sent the message.
The proposed maximum coordinate limit of the subview, in the split view’s flipped coordinate system.
Specifies the divider the user is moving, with the first divider being 0 and increasing from top to bottom (or left to right).
The maximum coordinate limit of the divider.
This method is invoked before the split view begins tracking the mouse to position a divider. You may further constrain the limits that have been already set, but you cannot extend the divider limits.
If the split bars are horizontal (views are one on top of the other), proposedMax is the bottom limit. If the split bars are vertical (views are side by side), proposedMax is the right limit. The initial value of proposedMax is the bottom (or right side) of the subview after the divider.
– isVertical (NSSplitView)NSSplitView.hAllows the delegate for sender to constrain the minimum coordinate limit of a divider when the user drags it.
- (CGFloat)splitView:(NSSplitView *)splitView constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)dividerIndex
The split view that sent the message.
The proposed minimum coordinate limit of the subview, in the split view’s flipped coordinate system.
Specifies the divider the user is moving, with the first divider being 0 and increasing from top to bottom (or left to right).
The minimum coordinate limit of the divider.
This method is invoked before the split view begins tracking the cursor to position a divider. You may further constrain the limits that have been already set, but you cannot extend the divider limits.
If the split bars are horizontal (views are one on top of the other), proposedMin is the top limit. If the split bars are vertical (views are side by side), proposedMin is the left limit. The initial value of proposedMin is the top (or left side) of the subview before the divider.
– isVertical (NSSplitView)NSSplitView.hAllows the delegate for sender to constrain the divider to certain positions.
- (CGFloat)splitView:(NSSplitView *)splitView constrainSplitPosition:(CGFloat)proposedPosition ofSubviewAt:(NSInteger)dividerIndex
The split view that sent the message.
The cursor’s current position, and the proposed position of the divider.
Specifies the divider the user is moving, with the first divider being 0 and increasing from top to bottom (or left to right).
The position at which to constrain the divider.
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.
NSSplitView.hAllows the delegate to modify the rectangle in which mouse clicks initiate divider dragging.
- (NSRect)splitView:(NSSplitView *)splitView effectiveRect:(NSRect)proposedEffectiveRect forDrawnRect:(NSRect)drawnRect ofDividerAtIndex:(NSInteger)dividerIndex
The split view that sent the message.
The proposed rectangle in which mouse clicks should initiate divider dragging. The rectangle is expressed in the coordinate system defined by splitView.
The frame of the divider, expressed in the coordinate system defined by splitView.
The index of the divider.
The rectangle in which mouse clicks should initiate divider dragging. The rectangle should be expressed in the coordinate system defined by splitView.
A split view with thick dividers proposes the drawn frame as the effective frame. A split view with thin dividers proposes an effective frame that's a little larger than the drawn frame, to make it easier for the user to actually grab the divider.
If a split view has no delegate, or if its delegate does not respond to this message, the split view behaves as if it has a delegate that returns proposedEffectiveRect when sent this message.
NSSplitView.hAllows the delegate to specify custom sizing behavior for the subviews of the NSSplitView sender.
- (void)splitView:(NSSplitView *)splitView resizeSubviewsWithOldSize:(NSSize)oldSize
The split view that sent the message.
The size of the split view before the user resized it.
If the delegate implements this method, splitView:resizeSubviewsWithOldSize: is invoked after the split view is resized.
The subviews should be resized such that the sum of the sizes of the subviews plus the sum of the thickness of the dividers equals the size of the NSSplitView’s new frame. You can get the thickness of a divider through the dividerThickness method.
Note that if you implement this delegate method to resize subviews on your own, the NSSplitView does not perform any error checking for you. However, you can invoke adjustSubviews to perform the default sizing behavior.
– adjustSubviews (NSSplitView)– setFrame: (NSView)NSSplitView.hAllows the delegate to specify whether the subview should be resized.
- (BOOL)splitView:(NSSplitView *)splitView shouldAdjustSizeOfSubview:(NSView *)subview
The split view that sent the message.
The subview to resize.
YES if adjustSubviews can change the size of the subview, otherwise NO.
Regardless of the value returned by this method, adjustSubviews may change the origin of the subview. Otherwise non-resizable subviews may also be resized in order to prevent an invalid subview layout.
If a split view has no delegate, or if its delegate does not respond to this message, the split view behaves as if this method returns YES.
NSSplitView.hInvoked to allow a delegate to determine if a subview should collapse in response to a double click.
- (BOOL)splitView:(NSSplitView *)splitView shouldCollapseSubview:(NSView *)subview forDoubleClickOnDividerAtIndex:(NSInteger)dividerIndex
The split view that sent the message.
The subview to collapse.
The index of the divider.
YES if the subview should collapse, NO otherwise.
If implemented, the delegate will receive this message once for the subview before a divider when the user double-clicks on that divider, and again for the subview after the divider, but only if the delegate returned YES when sent splitView:canCollapseSubview: for the subview in question. When the delegate indicates that both subviews should be collapsed NSSplitView's behavior is undefined.
NSSplitView.hAllows the delegate to determine whether a divider can be dragged or adjusted off the edge of the split view.
- (BOOL)splitView:(NSSplitView *)splitView shouldHideDividerAtIndex:(NSInteger)dividerIndex
The split view that sent the message.
The zero-based index of the divider.
YES if the divider should allow dragging off the edge of the split view, resulting in it not being visible.
If a split view has no delegate, or if its delegate does not respond to this message, the split view behaves as if it has a delegate that returns NO when sent this message.
NSSplitView.hInvoked by the default notification center to notify the delegate that the splitview did resize its subviews.
- (void)splitViewDidResizeSubviews:(NSNotification *)aNotification
A notification named NSSplitViewDidResizeSubviewsNotification.
If the delegate implements this method, the delegate is automatically registered to receive this notification.
This method is invoked after the split view resizes two of its subviews in response to the repositioning of a divider.
NSSplitView.hInvoked by the default notification center to notify the delegate that the splitview will resize its subviews.
- (void)splitViewWillResizeSubviews:(NSNotification *)aNotification
A notification named NSSplitViewWillResizeSubviewsNotification.
If the delegate implements this method, the delegate is automatically registered to receive this notification.
This method is invoked before the split view resizes two of its subviews in response to the repositioning of a divider.
NSSplitView.hLast updated: 2009-10-19