| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/AppKit.framework |
| Availability | Available in Mac OS X v10.0 and later. |
| Companion guide | |
| Declared in | NSTabView.h |
| Related sample code |
An NSTabView object provides a convenient way to present information in multiple pages. The view contains a row of tabs that give the appearance of folder tabs, as shown in the following figure. The user selects the desired page by clicking the appropriate tab or using the arrow keys to move between pages. Each page displays a view hierarchy provided by your application.

– indexOfTabViewItem:
– indexOfTabViewItemWithIdentifier:
– numberOfTabViewItems
– tabViewItemAtIndex:
– tabViewItems
– selectFirstTabViewItem:
– selectLastTabViewItem:
– selectNextTabViewItem:
– selectPreviousTabViewItem:
– selectTabViewItem:
– selectTabViewItemAtIndex:
– selectTabViewItemWithIdentifier:
– selectedTabViewItem
– takeSelectedTabViewItemFromSender:
Adds the tab item specified by tabViewItem.
- (void)addTabViewItem:(NSTabViewItem *)tabViewItem
The tab view item to be added.
The item is added at the end of the array of tab items, so the new tab appears on the right side of the view. If the delegate supports it, invokes the delegate’s tabViewDidChangeNumberOfTabViewItems: method.
– insertTabViewItem:atIndex:– numberOfTabViewItems– removeTabViewItem:– tabViewItemAtIndex:– tabViewItemsNSTabView.hReturns whether if the receiver allows truncating for labels that don’t fit on a tab.
- (BOOL)allowsTruncatedLabels
YES if the receiver allows truncating for labels that don’t fit on a tab, otherwise NO.
The default is NO.
When truncating is allowed, the tab view inserts an ellipsis, if necessary, to fit a label in the tab.
NSTabView.hReturns the rectangle describing the content area of the receiver.
- (NSRect)contentRect
Returns the rectangle describing the content area of the receiver.
This area does not include the space required for the receiver’s tabs or borders (if any).
NSTabView.hReturns the size of the receiver.
- (NSControlSize)controlSize
Valid return values are described inControl Sizes in NSCell Class Reference.
NSTabView.hReturns the receiver’s control tint.
- (NSControlTint)controlTint
The tab view’s control tint. See NSControlTint for the supported values.
NSTabView.hReturns the receiver’s delegate.
- (id < NSTabViewDelegate >)delegate
The object’s delegate.
NSTabView.hReturns whether if the receiver draws a background color when the tab view type is NSNoTabsNoBorder.
- (BOOL)drawsBackground
YES if the receiver draws a background color when the tab view type is NSNoTabsNoBorder, otherwise NO.
If the receiver uses bezeled edges or a line border, the appropriate background color for that border is used.
NSTabView.hReturns the font for tab label text.
- (NSFont *)font
Returns the tab view label font.
NSTabView.hReturns the index of the specified item in the tab view.
- (NSInteger)indexOfTabViewItem:(NSTabViewItem *)tabViewItem
The tab view item.
The zero-based index of tabViewItem, or [NSNotFound] if the item is not found.
The returned index is zero-based.
– indexOfTabViewItemWithIdentifier:– insertTabViewItem:atIndex:– numberOfTabViewItems– tabViewItemAtIndex:NSTabView.hReturns the index of the item that matches the specified identifier. identifier, or NSNotFound if the item is not found.
- (NSInteger)indexOfTabViewItemWithIdentifier:(id)identifier
The identifier of a tab view item.
The zero-based index of the tab view item corresponding to identifier, or [NSNotFound] if the item is not found.
The returned index is zero-based.
NSTabView.hInserts tabViewItem into the receiver’s array of tab view items at index.
- (void)insertTabViewItem:(NSTabViewItem *)tabViewItem atIndex:(NSInteger)index
The tab view item to be added.
The index at which to insert the tab view item. The index parameter is zero-based.
If there is a delegate and the delegate supports it, sends the delegate the tabViewDidChangeNumberOfTabViewItems: message.
– indexOfTabViewItem:– indexOfTabViewItemWithIdentifier:– numberOfTabViewItems– tabViewItemAtIndex:NSTabView.hReturns the minimum size necessary for the receiver to display tabs in a useful way.
- (NSSize)minimumSize
The minimum size necessary for the receiver to display tabs in a useful way.
You can use the value returned by this method to limit how much a user can resize a tab view.
NSTabView.hReturns the number of items in the receiver’s array of tab view items.
- (NSInteger)numberOfTabViewItems
The number of items in the tab view.
NSTabView.hRemoves the item specified by tabViewItem from the receiver’s array of tab view items.
- (void)removeTabViewItem:(NSTabViewItem *)tabViewItem
The tab view item to be removed.
If there is a delegate and the delegate supports it, sends the delegate the tabViewDidChangeNumberOfTabViewItems: message.
NSTabView.hReturns the tab view item for the currently selected tab
- (NSTabViewItem *)selectedTabViewItem
The currently selected tab view item, or nil if no item is selected.
NSTabView.hThis action method selects the first tab view item.
- (void)selectFirstTabViewItem:(id)sender
Typically the object that sent invoked the message.
NSTabView.hThis action method selects the last tab view item.
- (void)selectLastTabViewItem:(id)sender
Typically the object that sent invoked the message.
NSTabView.hThis action method selects the next tab view item in the sequence.
- (void)selectNextTabViewItem:(id)sender
Typically the object that sent invoked the message.
If the currently visible item is the last item in the sequence, this method does nothing, and the last page remains displayed.
NSTabView.hThis action method selects the previous tab view item in the sequence.
- (void)selectPreviousTabViewItem:(id)sender
Typically the object that sent invoked the message.
If the currently visible item is the first item in the sequence, this method does nothing, and the first page remains displayed.
NSTabView.hSelects the specified tab view item.
- (void)selectTabViewItem:(NSTabViewItem *)tabViewItem
The tab item to select.
If there is a delegate and the delegate supports it, sends the delegate the tabView:shouldSelectTabViewItem: message.
NSTabView.hSelects the tab view item specified by index.
- (void)selectTabViewItemAtIndex:(NSInteger)index
The index of the tab item to selected.
The index parameter is base 0. If there is a delegate and the delegate supports it, sends the delegate the tabView:shouldSelectTabViewItem: message.
NSTabView.hSelects the tab view item specified by identifier.
- (void)selectTabViewItemWithIdentifier:(id)identifier
The identifier of the tab item to select.
– setIdentifier: (NSTabViewItem)– identifier (NSTabViewItem)– selectTabViewItemAtIndex:– selectedTabViewItemNSTabView.hSets whether the receiver allows truncating for names that don’t fit on a tab.
- (void)setAllowsTruncatedLabels:(BOOL)allowTruncatedLabels
YES if the receiver allows truncating for labels that don’t fit on a tab, otherwise NO.
The default is NO.
When truncating is allowed, the tab view inserts an ellipsis, if necessary, to fit a label in the tab.
NSTabView.hSets the size of the receiver to controlSize.
- (void)setControlSize:(NSControlSize)controlSize
The size of the receiver. Valid values are described in Control Sizes in NSCell Class Reference
NSTabView.hSets the receiver’s control tint to controlTint.
- (void)setControlTint:(NSControlTint)controlTint
The tab view’s control tint. See NSControlTint for the supported values.
NSTabView.hSets the receiver’s delegate.
- (void)setDelegate:(id < NSTabViewDelegate >)anObject
The delegate object. It must conform to the NSTabViewDelegate protocol.
NSTabView.hSets whether a background is drawn when the view type is NSNoTabsNoBorder to flag.
- (void)setDrawsBackground:(BOOL)flag
YES if the background should be drawn, otherwise NO.
If the receiver has a bezeled border or a line border, the appropriate background for that border is used.
NSTabView.hSets the font for tab label text to font.
- (void)setFont:(NSFont *)font
The font to use as the tab view label font.
Tab height is adjusted automatically to accommodate a new font size. If the view allows truncating, tab labels are truncated as needed.
NSTabView.hSets the tab type to tabViewType.
- (void)setTabViewType:(NSTabViewType)tabViewType
The tab type to display the tabs. The supported values are listed in NSTabViewType
NSTabView.hReturns the tab view item at index in the tab view’s array of items.
- (NSTabViewItem *)tabViewItemAtIndex:(NSInteger)index
The index at which to insert the tab view item. The index parameter is zero-based.
The tab view item at the specified index.
NSTabView.hReturns the tab view item at the specified point.
- (NSTabViewItem *)tabViewItemAtPoint:(NSPoint)point
The hit point.
The tab view item under the hit point, or nil if no tab view item is under that location.
You can use this method to find a tab view item based on a user’s mouse click.
NSTabView.hReturns the receiver’s array of tab view items.
- (NSArray *)tabViewItems
An array of tab view items.
A tab view keeps an array containing one tab view item for each tab in the view.
NSTabView.hReturns the tab type for the receiver.
- (NSTabViewType)tabViewType
The tab type to display the tabs. The supported values are listed in NSTabViewType
NSTabView.hSets the selected tab view item to the selected item obtained from the sender.
- (void)takeSelectedTabViewItemFromSender:(id)sender
Typically the object that sent invoked the message.
If sender responds to the indexOfSelectedItem method, this method invokes that method and selects the tab view item at the specified index.
NSTabView.hThese constants specify the tab view’s type as used by tabViewType and setTabViewType:.
enum {
NSTopTabsBezelBorder = 0,
NSLeftTabsBezelBorder = 1,
NSBottomTabsBezelBorder = 2,
NSRightTabsBezelBorder = 3,
NSNoTabsBezelBorder = 4,
NSNoTabsLineBorder = 5,
NSNoTabsNoBorder = 6
};
typedef NSUInteger NSTabViewType;
NSTopTabsBezelBorderThe view includes tabs on the top of the view and has a bezeled border (the default).
Available in Mac OS X v10.0 and later.
Declared in NSTabView.h.
NSNoTabsBezelBorderThe view does not include tabs and has a bezeled border.
Available in Mac OS X v10.0 and later.
Declared in NSTabView.h.
NSNoTabsLineBorderThe view does not include tabs and has a lined border.
Available in Mac OS X v10.0 and later.
Declared in NSTabView.h.
NSNoTabsNoBorderThe view does not include tabs and has no border.
Available in Mac OS X v10.0 and later.
Declared in NSTabView.h.
NSBottomTabsBezelBorderTabs are on the bottom of the view with a bezeled border.
Available in Mac OS X v10.0 and later.
Declared in NSTabView.h.
NSLeftTabsBezelBorderTabs are on the left of the view with a bezeled border.
Available in Mac OS X v10.0 and later.
Declared in NSTabView.h.
NSRightTabsBezelBorderTabs are on the right of the view with a bezeled border.
Available in Mac OS X v10.0 and later.
Declared in NSTabView.h.
This constant specifies the minimum version of the Application Kit that supports directional tabs.
#define NSAppKitVersionNumberWithDirectionalTabs 631.0
NSAppKitVersionNumberWithDirectionalTabsThe specific version of the AppKit framework that introduced support for directional tab items. Developers should not need to use this constant unless they are writing applications for Mac OS X v10.1 and earlier.
Available in Mac OS X v10.2 and later.
Declared in NSTabView.h.
Last updated: 2009-06-23