| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/AppKit.framework |
| Availability | Available in Mac OS X v10.0 and later. |
| Declared in | NSSplitView.h |
| Companion guides | |
| Related sample code |
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 Deprecated in Mac OS X v10.6
– setIsPaneSplitter: Deprecated in Mac OS X v10.6
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.
In Mac OS X v 10.5 and earlier adjustSubviews did not invalidate the split view’s cursor. This made it difficult to correctly animate divider positioning by sending setFrameSize: to the animator proxy of the subviews on either side of the divider and letting adjustSubviews to be invoked repeatedly during the animation. In Mac OS 10.6 and later adjustSubviews now adjustSubviews now invalidates its cursor so the cursor over the divider is always correct during and after such an animation.
– 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 < NSSplitViewDelegate >)delegate
The receiver’s delegate object.
NSSplitView.hReturn the color of the dividers that the split view is drawing between subviews.
- (NSColor *)dividerColor
The color of the divider drawn between the subviews.
The default implementation of this method returns clearColor when dividerStyle returns NSSplitViewDividerStyleThick or when dividerStyle returns NSSplitViewDividerStylePaneSplitter and the receiver is in a textured window. All other thin dividers are drawn with a color that looks good between two white panes.
You can override this method to change the color of dividers.
NSSplitView.hReturns the style of the divider drawn between subviews.
- (NSSplitViewDividerStyle)dividerStyle
The current divider style. The possible values are described in “Split View Divider Styles.”
NSSplitView.hReturns the thickness of the divider.
- (CGFloat)dividerThickness
The thickness of the divider.
You can subclass NSSplitView and override this method to change the divider’s size, if necessary.
NSSplitView.hDraws the divider between two of the receiver’s subviews.
- (void)drawDividerInRect:(NSRect)aRect
The entire divider rectangle in the receiver’s coordinate system, which is 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 whether the specified view is collapsed.
- (BOOL)isSubviewCollapsed:(NSView *)subview
The subview in the splitview.
YES if subview is in a collapsed state, NO otherwise.
NSSplitView.hReturns whether the split bars are vertical.
- (BOOL)isVertical
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).
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.hSets the receiver’s delegate.
- (void)setDelegate:(id < NSSplitViewDelegate >)theDelegate
The receiver’s delegate object.
NSSplitView.hSets the style of divider drawn between subviews.
- (void)setDividerStyle:(NSSplitViewDividerStyle)dividerStyle
The divider style. Possible values are described in “Split View Divider Styles.”
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 YES, the split bars are vertical (views are side by side); if NO, they’re horizontal (views are one on top of the other).
Split bars are horizontal by default.
NSSplitView.hThese constants specify the possible divider styles used by dividerStyle and setDividerStyle:.
enum {
NSSplitViewDividerStyleThick = 1,
NSSplitViewDividerStyleThin = 2,
NSSplitViewDividerStylePaneSplitter = 3,
};
typedef NSInteger NSSplitViewDividerStyle;
NSSplitViewDividerStyleThickA thick style divider is displayed between subviews. This is the default.
Available in Mac OS X v10.5 and later.
Declared in NSSplitView.h.
NSSplitViewDividerStyleThinA thin style divider is displayed between subviews.
Available in Mac OS X v10.5 and later.
Declared in NSSplitView.h.
NSSplitViewDividerStylePaneSplitterA thick style divider with a 3D appearance is displayed between subviews.
Available in Mac OS X v10.6 and later.
Declared in 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.
userInfo dictionary contains a key @"NSSplitViewDividerIndex" containing an NSNumber-wrapped NSInteger that is the index of the divider being dragged. Earlier versions of Mac OS X do not return a user info dictionary in any situation.– splitViewDidResizeSubviews: (NSSplitViewDelegate Protocol)NSSplitView.hPosted 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.
userInfo dictionary contains a key @"NSSplitViewDividerIndex" containing an NSInteger-wrapped NSNumber that is the index of the divider being dragged. Earlier versions of Mac OS X do not return a user info dictionary in any situation.– splitViewWillResizeSubviews: (NSSplitViewDelegate Protocol)NSSplitView.hLast updated: 2009-10-19