Class

NSToolbar

An object that manages the space immediately below a window's title bar and above your app's custom content.

Declaration

@interface NSToolbar : NSObject

Overview

Toolbars manage controls and content that apply to the content of a window. Items in the toolbar are represented by NSToolbarItem objects.

Topics

Creating an NSToolbar Object

- initWithIdentifier:

Initializes a newly allocated toolbar with the specified identifier.

Configuring the Toolbar Contents

delegate

The toolbar’s delegate.

NSToolbarDelegate

A set of optional methods implemented by toolbar delegates to configure the toolbar and respond to changes.

Toolbar Attributes

identifier

The receiver’s identifier.

displayMode

The toolbar’s display mode.

showsBaselineSeparator

A Boolean value that indicates whether the toolbar shows the separator between the toolbar and the main window contents.

allowsUserCustomization

A Boolean value that indicates whether users are allowed to modify the toolbar.

allowsExtensionItems

A Boolean value that indicates whether the toolbar can add items for Action extensions.

items

An array containing the toolbar’s current items, in order.

visibleItems

An array containing the toolbar’s currently visible items.

sizeMode

The toolbar’s size mode.

Managing Items on the Toolbar

- insertItemWithItemIdentifier:atIndex:

Inserts the specified item at the specified index.

- removeItemAtIndex:

Removes the specified item.

selectedItemIdentifier

Returns the identifier of the receiver’s currently selected item, or nil if there is no selection.

Displaying the Toolbar

visible

A Boolean value that indicates whether the toolbar is visible.

Toolbar Customization

- runCustomizationPalette:

Runs the receiver’s customization palette.

customizationPaletteIsRunning

A Boolean value that indicates whether the receiver’s customization palette is running (in use).

Full Screen Accessory View Settings

fullScreenAccessoryView

The toolbar’s full screen accessory view.

Deprecated
fullScreenAccessoryViewMaxHeight

The maximum height of the toolbar’s full screen accessory view, in points.

Deprecated
fullScreenAccessoryViewMinHeight

The minimum height of the toolbar’s full screen accessory view.

Deprecated

Autosaving the Configuration

autosavesConfiguration

A Boolean value that indicates whether the receiver autosaves its configuration.

configurationDictionary

A dictionary containing configuration information for the toolbar.

Validating Visible Items

- validateVisibleItems

Called on window updates to validate the visible items.

Constants

NSToolbarDisplayMode

These constants specify toolbar display modes and are used by the displayMode property.

NSToolbarSizeMode

These constants specify toolbar display modes and are used by the sizeMode property.

Notifications

NSToolbarDidRemoveItemNotification

Posted after an item is removed from a toolbar.

NSToolbarWillAddItemNotification

Posted before a new item is added to the toolbar.

Relationships

Inherits From

See Also

View

NSToolbarItemValidation

Validation of a toolbar item.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software