Max Chuquimia
Max Chuquimia

Reputation: 7824

How do you disable the overflow menu of an NSToolbar?

I've created an NSToolbar that has a few items in Interface Builder (and set their visibility priority). When I resize the window, items are removed according to their priority as expected, however an overflow button appears with an empty menu. How can I stop this from happening?

Example

Upvotes: 3

Views: 427

Answers (1)

Max Chuquimia
Max Chuquimia

Reputation: 7824

Each NSToolbarItem has a menuFormRepresentation property that can be set to nil to stop it from appearing in this menu. So, do this on all the items in the toolbar to stop the button from appearing:

toolbar?.items.forEach({ (item) in
    item.menuFormRepresentation = nil
})

Upvotes: 4

Related Questions