I am looking to disable the Command + Click combination on a toolbar button (located top-right) in a Cocoa window. I would still like to let the user show and hide the toolbar, but I do not want them to be able to select a different display mode (e.g. small icons, no icons, etc).
Has anyone found a way to do this? Thanks in advance.
You don't need to subclass NSToolbar to do this. In your NSWindowController subclass, put the following in your awakeFromNib:
- (void) awakeFromNib
{
NSToolbar *tb = [[self window] toolbar];
[tb setAllowsUserCustomization:NO];
}
You also have the added benefit of avoiding private API use.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With