A container view controller that manages a tab view interface, which organizes multiple pages of content but displays only one page at a time.


@interface NSTabViewController : NSViewController


Each page of content is managed by a separate child view controller. Navigation between child view controllers is accomplished with the help of an NSTabView object, which the tab view controller manages. When the user selects a new tab, the tab view controller displays the content associated with the associated child view controller, replacing the previous content.

Each tab is represented by an NSTabViewItem object, which contains the name of the tab and stores a pointer to the child view controller that manages the tab’s content. Normally, you configure the tab view items at design time using Interface Builder, but you can also add them programmatically using the methods of this class. Always assign a child view controller to new tab view items before adding those items to the tab view interface.

Another way to add tabs programmatically is to add child view controllers directly to the tab view controller. When you call the addChildViewController: or insertChildViewController:atIndex: method of this class, the tab view controller automatically creates a default NSTabViewItem object for the specified view controller. You can fetch the newly created item using the tabViewItemForViewController: method and configure it. Removing a child view controller with the removeChildViewControllerAtIndex: method similarly removes the corresponding tab view item.

The tab view controller lazily loads the views associated with each child view controller, creating them only after the corresponding tab is selected. When the tab view controller’s view is first displayed, only the view for the initially selected tab is loaded.

The tabStyle property determines the appearance of the tab controls. A tab view controller can display a segmented control or display tabs in the window’s toolbar. You can also provide your own control for displaying tabs. The tab view controller automatically coordinates interactions between designated control and the corresponding tabView object.


Configuring the Tab View


The style used to display the tabs.


The tab view that manages the views of the interface.


The animation options to use when switching between tabs.


A Boolean value indicating whether the tab view controller gets its title from the selected child view controller.

Managing Tab View Items


The array of tab view items used to manage each of the child view controllers.

- tabViewItemForViewController:

Returns the tab view item for the specified child view controller.

- addTabViewItem:

Adds the specified tab to the end of the tab view controller’s list of tabs.

- insertTabViewItem:atIndex:

Inserts a tab view into the tab view controller’s list of tabs.

- removeTabViewItem:

Removes the specified tab view item from the tab view controller.


The index of the selected tab.

Responding to Tab View Events

- viewDidLoad

Called after the view controller’s view has been loaded into memory.

- tabView:shouldSelectTabViewItem:

Asks the tab view controller if the specified tab should be selected.

- tabView:willSelectTabViewItem:

Informs the tab view controller that the specified tab is about to be selected.

- tabView:didSelectTabViewItem:

Informs the tab view controller that the specified tab was selected.

Responding to Toolbar Events

- toolbar:itemForItemIdentifier:willBeInsertedIntoToolbar:

Returns the toolbar item for the specified identifier.

- toolbarAllowedItemIdentifiers:

Returns the array of identifier strings for the allowed toolbar items.

- toolbarDefaultItemIdentifiers:

Returns the array of identifier strings for the default toolbar items.

- toolbarSelectableItemIdentifiers:

Returns the array of identifier strings for the selectable toolbar items



Tab control style options for a tab view controller.


Inherits From

See Also

Tab View Interface


A multipage interface that displays one page at a time.


An item in a tab view.