Re: how to load an NSMenu out of a nib?
Re: how to load an NSMenu out of a nib?
- Subject: Re: how to load an NSMenu out of a nib?
- From: Uli Kusterer <email@hidden>
- Date: Thu, 9 Apr 2009 02:04:06 +0200
On 09.04.2009, at 01:55, Rua Haszard Morris wrote:
still, I was expecting a line or two of code, not to have to make an
instance variable for things I want out of the nib!
I'm still shocked there's no standard way to do this...
I think you're taking the wrong approach, conceptually. Usually, you
have a controller, so you can just create a controller that loads a
NIB and point the outlet at the menu. Create a new instance of this
controller each time, not just the menu. Your app-specific logic for
the menu should be in that (menu-specific) controller anyway.
Alternately, instead of loading a new menu each time, just copy the
menu. It supports the NSCopying protocol, after all.
As always, we are back to Cocoa's rule #1: If something seems to be
incredibly complicated or impossible to do in Cocoa, you're doing it
the wrong way. Cocoa encourages good designs.
Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
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