Represents a NSToolbar. You shouldn’t instantiate it directly, alsways instatiate it through Window.createToolbar().
NSToolbar, delegate and XIBs. I don’t know how XCode manages to allow the design of toolbars without using the delegate property of that toolbar. My guess is that they use some kind of private API. To create a functional toolbar, one has to have a toolbar delegate to create NSToolbarItem instance. This is what xibless does. Therefore, consider your toolbar’s delegate slot taken.
Moreover, that delegate has to be allocated and created at some point, but there is no convenient way to pass the reference’s responsibility to the xibless user. Therefore, the instance of the delegate created for the toolbar will be leaked, so will toolbar items.
In most cases, this isn’t a big deal because the window that contains a toolbar is often a window that lives as long as the application. However, if the leak of the toolbar delegate is a problem, what you should do is to take the ownership of the delegate in your own code and release it yourself.
Cocoa constant. Whether the toolbar displays images and text, or just images, or just text. Use with NSToolbarDisplayMode constants.
Boolean. Whether the user can customize the toolbar.
Boolean. Whether the toolbar’s state is autosaved/restored.
Parameters: |
|
---|
Creates a ToolbarItem with the specified arguments, adds it to the toolbar and returns it. Note that to avoid needless verbosity, the final identifier of the item will be the concatenation of the toolbar’s identifier and the argument. So if your toolbar’s identifier is foo and you call additem('bar', 'mylabel'), the item’s identifier will be foobar.
Return a Cocoa constant representing one of the built-in toolbar items. Use it to populate defaultItems.