NSTabViewController
A container view controller that manages a tab view interface, which organizes multiple pages of content but displays only one page at a time.
Declaration
class NSTabViewControllerOverview
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 addChild(_:) or insertChild(_:at:) 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 tabViewItem(for:) method and configure it. Removing a child view controller with the removeChild(at:) 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.
Topics
Configuring the Tab View
Managing Tab View Items
tabViewItemstabViewItem(for:)addTabViewItem(_:)insertTabViewItem(_:at:)removeTabViewItem(_:)selectedTabViewItemIndex
Responding to Tab View Events
Responding to Toolbar Events
toolbar(_:itemForItemIdentifier:willBeInsertedIntoToolbar:)toolbarAllowedItemIdentifiers(_:)toolbarDefaultItemIdentifiers(_:)toolbarSelectableItemIdentifiers(_:)