• 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
NSToolbarItem with custom view in Interface Builder 3 (Leopard)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSToolbarItem with custom view in Interface Builder 3 (Leopard)


  • Subject: NSToolbarItem with custom view in Interface Builder 3 (Leopard)
  • From: Gunnar Proppe <email@hidden>
  • Date: Sat, 9 May 2009 11:36:00 -0700 (PDT)

I followed the steps described here to set up a toolbar item with a custom view in Interface Builder:
http://developer.apple.com/documentation/Cocoa/Conceptual/Toolbars/Articles/ToolbarInIB.html

Unfortunately my custom view's drawRect is never called. I verified that it does get initialized. The toolbar item's min and max size are set up properly. Just to be safe I had my view conform to NSCoding but initWithCoder and ecodeWithCoder aren't called. I tried various springs and struts settings with no results.

Digging deeper, I subclassed NSToolbarItem and overrode setView and setMinSize so I could break on them. setMinSize is getting called with the correct values. Interestingly, setView gets called before my custom view is initialized. I assume this is the proxy NSView object. Then my custom view is initialized (initWithFrame) but the NSToolbarItem's setView isn't called again with the new view instance. I don't know if this is a bug -- maybe Cocoa does some voodoo in the swapping from the proxy NSView object to the custom view.

Standard views work fine: eg. NSButton and NSBox.

Has anyone successfully used IB to create toolbar items with custom views?

Thanks,
Gunnar



_______________________________________________

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

  • Follow-Ups:
    • Re: NSToolbarItem with custom view in Interface Builder 3 (Leopard)
      • From: Jonathan Hess <email@hidden>
  • Prev by Date: Listing running process
  • Next by Date: Xcode 3.1.3 console output broken
  • Previous by thread: Re: Listing running process
  • Next by thread: Re: NSToolbarItem with custom view in Interface Builder 3 (Leopard)
  • Index(es):
    • Date
    • Thread