Toolbars

Toolbars in Cocoa are strips of controls that can be used as shortcuts. A toolbar can display its items as a text menu or as a graphical item. Items that don’t fit across the window are put into an overflow menu accessed by a right-pointing double arrow at the right edge of the toolbar. Toolbars are displayed in a strip across the top of the window, just under the title bar, and are managed by the window itself.

The NSToolbar class implements a toolbar, and the NSToolbarItem class implements the individual items in a toolbar. A toolbar item normally acts like a borderless button, sending an action message when it is clicked. This kind of item needs to be assigned an image, title, target, and action. Toolbar items can also be configured ...

Get Cocoa® Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.