NSToolbarItemGroup is a subclass of
NSToolbarItem which contains subitems. The views and labels of the subitems are used, but the parent's attributes take precedence.
- macOS 10.5+
To configure an instance of
NSToolbarItemGroup, you first create the individual toolbar items that will be the subitems:
and then put them in a grouped item:
In this configuration, you get two grouped items, and two labels. This differs from ordinary
NSToolbarItem objects because they are attached—the user drags them together as a single item rather than separately.
If you set a label on the parent item:
you get two grouped items with one shared label.
If instead you set a view on the parent item, you get two labels with one shared view: