| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/AppKit.framework |
| Availability | Available in Mac OS X v10.0 and later.
|
| Companion guide | |
| Declared in | NSSplitView.h |
An NSSplitView object stacks several subviews within one view so that the user can change their relative sizes. By default, the split bars between the views are horizontal, so the views are one on top of the other.
Divider indices are zero-based, with the topmost (in horizontal split views) or leftmost (vertical) divider having an index of 0.
– isPaneSplitter
– setIsPaneSplitter:
– splitView:effectiveRect:forDrawnRect:ofDividerAtIndex: delegate method
– splitView:additionalEffectiveRectOfDividerAtIndex: delegate method
– splitView:resizeSubviewsWithOldSize: delegate method
– splitViewWillResizeSubviews: delegate method
– splitViewDidResizeSubviews: delegate method
– splitView:canCollapseSubview: delegate method
– splitView:shouldCollapseSubview:forDoubleClickOnDividerAtIndex: delegate method
– setAutosaveName:
– autosaveName
– minPossiblePositionOfDividerAtIndex:
– maxPossiblePositionOfDividerAtIndex:
– setPosition:ofDividerAtIndex:
– splitView:constrainMaxCoordinate:ofSubviewAt: delegate method
– splitView:constrainMinCoordinate:ofSubviewAt: delegate method
– splitView:constrainSplitPosition:ofSubviewAt: delegate method
Adjusts the sizes of the receiver’s subviews so they (plus the dividers) fill the receiver.
- (void)adjustSubviews
The subviews are resized proportionally; the size of a subview relative to the other subviews doesn’t change.
– setDelegate:– setFrame: (NSView)NSSplitView.hReturns the name under which receiver’s divider position is automatically saved.
- (NSString *)autosaveName
The name used to save the receiver’s state.
NSSplitView.hReturns the receiver’s delegate.
- (id)delegate
NSSplitView.h
Returns the thickness of the divider.
- (CGFloat)dividerThickness
You can subclass NSSplitView and override this method to change the divider’s size, if necessary.
NSSplitView.h
Draws the divider between two of the receiver’s subviews.
- (void)drawDividerInRect:(NSRect)aRect
aRect describes the entire divider rectangle in the receiver’s coordinates, which are flipped. If you override this method and use a custom icon to identify the divider, you may need to change the size of the divider.
NSSplitView.hReturns YES if the receiver’s splitter is a bar that goes across the split view. Returns NO if the splitter is a thumb on the regular background pattern.
- (BOOL)isPaneSplitter
NSSplitView.hReturns YES if subview is in a collapsed state, NO otherwise.
- (BOOL)isSubviewCollapsed:(NSView *)subview
NSSplitView.h
Returns YES if the split bars are vertical (subviews are side by side), NO if they are horizontal (views are one on top of the other).
- (BOOL)isVertical
By default, split bars are vertical.
NSSplitView.hReturns the maximum possible position of the divider at the specified index.
- (CGFloat)maxPossiblePositionOfDividerAtIndex:(NSInteger)dividerIndex
The index of the divider.
A CGFloat specifying the maximum possible position of the divider.
The position is "possible" in that it is dictated by the bounds of the receiver and the current position of other dividers. "Allowable" positions are those that result from letting the delegate apply constraints to the possible positions.
You can invoke this method to determine the range of values that can be usefully passed to setPosition:ofDividerAtIndex:.
You can also invoke it from delegate methods like splitView:constrainSplitPosition:ofSubviewAt:: to implement relatively complex behaviors that depend on the current state of the split view.
The results of invoking this method when adjustSubviews has not been invoked, and the subview frames are invalid, is undefined.
NSSplitView.hReturns the minimum possible position of the divider at the specified index.
- (CGFloat)minPossiblePositionOfDividerAtIndex:(NSInteger)dividerIndex
The index of the divider.
A CGFloat specifying the minimum possible position of the divider.
The position is "possible" in that it is dictated by the bounds of the receiver and the current position of other dividers. "Allowable" positions are those that result from letting the delegate apply constraints to the possible positions.
You can invoke this method to determine the range of values that can be usefully passed to setPosition:ofDividerAtIndex:.
You can also invoke it from delegate methods like splitView:constrainSplitPosition:ofSubviewAt:: to implement relatively complex behaviors that depend on the current state of the split view.
The results of invoking this method when adjustSubviews has not been invoked, and the subview frames are invalid, is undefined.
NSSplitView.hSets the name under which receiver’s divider position is automatically saved.
- (void)setAutosaveName:(NSString *)autosaveName
The name used to save the receiver’s state.
If this value is nil or the string is empty no autosaving is done.
NSSplitView.h
Makes anObject the receiver’s delegate.
- (void)setDelegate:(id)anObject
The notification messages the delegate can expect to receive are listed in “Notifications.” The delegate doesn’t need to implement all of the delegate methods.
NSSplitView.hSets the type of splitter.
- (void)setIsPaneSplitter:(BOOL)flag
If flag is YES, the receiver’s splitter is a bar that goes across the split view. If flag is NO, the splitter is a thumb on the regular background pattern.
NSSplitView.hSets the position of the divider at the specified index.
- (void)setPosition:(CGFloat)position ofDividerAtIndex:(NSInteger)dividerIndex
The position of the divider
The index of the divider.
The default implementation of this method behaves as if the user were attempting to drag the divider to the proposed position, so the constraints imposed by the delegate are applied and one of the views adjacent to the divider may be collapsed.
This method is not invoked by NSSplitView itself.
NSSplitView.hSets whether the split bars are vertical.
- (void)setVertical:(BOOL)flag
If flag is YES, they’re vertical (views are side by side); if it’s NO, they’re horizontal (views are one on top of the other). Split bars are horizontal by default.
NSSplitView.hAllows 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 *)sender canCollapseSubview:(NSView *)subview
If this method returns NO or is not implemented, subview can’t be collapsed. If this method returns YES, subview collapses when the user drags a divider beyond the halfway mark between its minimum size and its edge. subview uncollapses when the user drags the divider back beyond that point. To specify the minimum size, define the methods splitView:constrainMaxCoordinate:ofSubviewAt: and splitView:constrainMinCoordinate:ofSubviewAt:. Note that a subview can collapse only if you also define splitView:constrainMinCoordinate:ofSubviewAt:.
A collapsed subview is hidden but retained by the NSSplitView object, with the same size it had before it was collapsed.
NSSplitView.hAllows the delegate for sender to constrain the maximum coordinate limit of a divider when the user drags it.
- (CGFloat)splitView:(NSSplitView *)sender constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)offset
This method is invoked before the NSSplitView 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. proposedMax is specified in the NSSplitView’s flipped coordinate system. 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. offset specifies the divider the user is moving, with the first divider being 0 and going up from top to bottom (or left to right).
NSSplitView.hAllows the delegate for sender to constrain the minimum coordinate limit of a divider when the user drags it.
- (CGFloat)splitView:(NSSplitView *)sender constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)offset
This method is invoked before the NSSplitView 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. proposedMin is specified in the NSSplitView’s flipped coordinate system. 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. offset specifies the divider the user is moving, with the first divider being 0 and going up from top to bottom (or left to right).
NSSplitView.hAllows the delegate for sender to constrain the divider to certain positions.
- (CGFloat)splitView:(NSSplitView *)sender constrainSplitPosition:(CGFloat)proposedPosition ofSubviewAt:(NSInteger)offset
If the delegate implements this method, the NSSplitView calls it repeatedly as the user moves the divider. This method returns where you want the divider to be, given proposedPosition, the cursor’s current position. offset is the divider the user is moving, with the first divider being 0 and going up from top to bottom (or from left to right).
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 litte 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 *)sender resizeSubviewsWithOldSize:(NSSize)oldSize
If the delegate implements this method, splitView:resizeSubviewsWithOldSize: is invoked after the NSSplitView is resized. The size of the NSSplitView before the user resized it is indicated by oldSize; 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– setFrame: (NSView)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 splitview 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.hInvoked by the default notification center to notify the delegate that the splitview did resize its subviews.
- (void)splitViewDidResizeSubviews:(NSNotification *)aNotification
An NSSplitViewDidResizeSubviewsNotification notification.
If the delegate implements this method, the delegate is automatically registered to receive this notification.
This method is invoked after the NSSplitView 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
An NSSplitViewWillResizeSubviewsNotification notification.
If the delegate implements this method, the delegate is automatically registered to receive this notification.
This method is invoked before the NSSplitView resizes two of its subviews in response to the repositioning of a divider.
NSSplitView.h
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.
Posted after an NSSplitView changes the sizes of some or all of its subviews. The notification object is the NSSplitView that resized its subviews. This notification does not contain a userInfo dictionary.
NSSplitView.h
Posted before an NSSplitView changes the sizes of some or all of its subviews. The notification object is the NSSplitView object that is about to resize its subviews. This notification does not contain a userInfo dictionary.
NSSplitView.h
Last updated: 2007-06-13