insertItem(withItemIdentifier:at:)
Inserts an item into the toolbar at the specified index.
Declaration
func insertItem(withItemIdentifier itemIdentifier: NSToolbarItem.Identifier, at index: Int)Parameters
- itemIdentifier:
The identifier of the toolbar item to insert.
- index:
The index at which to insert the item.
Discussion
Typically, you don’t call this method directly from your code. Instead, you specify your toolbar’s allowed items, and the set of default items you want to appear. After that, you let the user customize the toolbar.
Any changes you make to the toolbar appear in all NSToolbar objects with the same identifier value. If a toolbar item with the specified identifier isn’t available, the toolbar calls the toolbar(_:itemForItemIdentifier:willBeInsertedIntoToolbar:) method of its delegate to get the item. This method does not trigger a call to your delegate’s toolbar(_:itemIdentifier:canBeInsertedAt:) method.