0

I have a NSToolbar which contains a NSSearchField.

I have changed the image of the search button cell (in awakeFromNib) to one that more accurately describes what I am doing.

Unfortunately, if the user customises the toolbar the default image is restored.

How can I either a) prevent Customisation, but still allow the user to select icons and/or text b) detect the change, so I can restore the desired icon c) change the image on the default

Milliways
  • 1,265
  • 1
  • 12
  • 26

1 Answers1

0

Maybe b

Use NSToolbar Delegate and implement

- (NSToolbarItem *) toolbar:(NSToolbar *)toolbar
      itemForItemIdentifier:(NSString *)itemIdentifier
  willBeInsertedIntoToolbar:(BOOL)flag

There you could give back your custom Item.

pbx
  • 1,137
  • 7
  • 15
  • I have tried this, unfortunately this is never called - there is nothing that the user can actually add to the toolbar. – Milliways May 30 '12 at 12:48
  • Strange. According to Apple this must be called. Did you connect the delegate either in Interface or code? – pbx May 30 '12 at 13:49