• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSToolbar setup in conjunction with IB
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSToolbar setup in conjunction with IB


  • Subject: NSToolbar setup in conjunction with IB
  • From: Gideon King <email@hidden>
  • Date: Tue, 22 Jun 2010 21:25:31 +1000

Hi, I have a toolbar that has been set up in Interface Builder, and this is working just fine, but now I am in a situation where for some users of the application I want to remove a couple of items from the toolbar items completely. I will know whether I need them or not when the window is first created, and I never need to add them back in if they are not required for that user.

I looked at toolbarAllowedItemIdentifiers: and toolbarDefaultItemIdentifiers:, but even if I do return an array excluding the items I don't want, the IB settings override this.

I looked at the toolbar:itemForItemIdentifier:willBeInsertedIntoToolbar: to see if I could just return nil for those items, and although I can do that, there appears to be no way of accessing the other items that have been instantiated in IB to be able to return them for the other items, and besides, the items I don't want displayed still appear in the customization window. Also, it appears that the configurationDictionary only contains items that are currently on the toolbar, so I can't affect the default items from there, and removeItemAtIndex: only affects the displayed items, and not the available items in the customization palette.

These same issues appear to preclude using the IB settings without the items I sometimes want, and adding them at runtime too.

In the documentation, it says "At runtime, you may combine toolbars and toolbar items that are unarchived from a nib file and those that are programmatically created."

Based on my findings so far, I can't see how you can combine them - it appears you have to either work entirely with the items created in IB, or do the whole thing programmatically. While it's not a huge thing to create them programmatically, I did try to go the combined route because firstly, the interface is already set up in IB, and secondly the documentation seems to suggest that it should be possible to do what I am wanting to do.

Is it possible to either:
a) Add all the items in IB, and remove the ones I don't want at runtime, or
b) Add all the items I always want in IB, and add the other ones I sometimes want at runtime?


Thanks

Gideon







_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: Threaded DOM operations
  • Next by Date: Re: detect NSPopUpButton changes
  • Previous by thread: Re: can we have own application logo for ad-hoc release.
  • Next by thread: Incomplete rendering returned from glReadPixels
  • Index(es):
    • Date
    • Thread