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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to