Introduction to Toolbars
NSToolbar and NSToolbarItem provide you with a standard way to display a toolbar for a titled window below its title bar. These classes also provide users with a standard way to customize toolbars and save those customizations.
Organization of This Document
This programming topic describes how to use toolbars. It contains the following articles:
How Toolbars Work gives basic information on toolbars.
Toolbar Management Checklist describes what happens when you create a toolbar.
Adding and Removing Toolbar Items describes managing toolbar items, and the role of the NSToolbar delegate.
Setting a Toolbar Item’s Representation describes the different ways a toolbar item can be represented and how to set them.
Validating Toolbar Items describes how to set whether a toolbar item is clickable or not.
Setting a Toolbar Item’s Size describes how to set a toolbar item’s minimum and maximum size.
Selectable Toolbar Items describes how to support selectable toolbar items.
Subclassing NSToolbarItem describes the methods to override when subclassing NSToolbarItem.
Techniques for Toolbar Management describes how to determine if a toolbar has items in the overflow menu and how to calculate toolbar height.
The following sample code is available through Apple Developer Connection:
iSpend shows how to add basic toolbar support to an application.
ToolbarSample: Using NSToolbar to construct a window toolbar implements an example toolbar including using custom views in a toolbar item.