toolbars in the
implements the toolbar itself, while
represents the individual icons and controls within the toolbar.
Unfortunately, as of the December 2002 release of the Developer Tools, toolbars cannot be created within Interface Builder. Instead, you have to create them manually with code.
To create a
toolbar, instantiate an instance of
initialize it with the method
The identifier in this method is a string that identifies the toolbar
within an application (it is used, for example, in document-based
applications to reflect changes in a toolbar in one document window
in all the toolbars of all open document-windows). To attach a
toolbar to a window, invoke
NSWindow returns a window’s
a two action methods for interacting with toolbars. The method
toggleToolbarShown: hides and shows the toolbar.
This is the action for the “Hide
Toolbar” menu item (as well as the pill-shaped
button on the right side of the window’s title bar).
toggleToolbarShown: causes the title of
this menu item to alternate between “Hide
Toolbar” and “Show
Toolbar”. This method relies on
if the toolbar is present, and
setVisible: takes a
indicating whether the toolbar should be hidden or shown.