A container view controller that manages a tab view interface, which organizes multiple pages of content but displays only one page at a time.
- macOS 10.10+
Each page of content is managed by a separate child view controller. Navigation between child view controllers is accomplished with the help of an
NSTab 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
NSTab 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
insert method of this class, the tab view controller automatically creates a default
NSTab object for the specified view controller. You can fetch the newly created item using the
tab method and configure it. Removing a child view controller with the
remove 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.
tab 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