Search code examples
swiftmacosxcode-storyboardnstoolbarnstoolbaritem

Customize space between items in a NSToolbar


In my MacOS app I have a NSToolbar with some toolbar items (NSToolbarItem) inside. I've been trying to change the space between the items by subclassing both NSToolbar and NSToolbarItem, but without success. Is there a way to customize this space?


Solution

  • To solve this i ended up inserting all the views of each toolbar item into a stack, so I could control the space between them with the spacing property of NSStackView. Then my toolbar has only the stack as a ToolbarItem.