Re: awakeFromNib
Re: awakeFromNib
- Subject: Re: awakeFromNib
- From: j o a r <email@hidden>
- Date: Mon, 16 Jun 2008 08:59:17 -0700
On Jun 16, 2008, at 8:07 AM, David Harper wrote:
I am setting up a preferences window, and I would like awakeFromNib:
to be invoked earlier than it does. Currently, it only gets invoked
when the preferences window is shown / opened.
You can call: -[NSWindowController loadWindow]
But I'm not sure if that's really what you should be doing - see my
comments below.
I expected that there might be an option to specify this in the .nib
file itself, and I got my hopes up with the "deferred" check box
which is enabled by default - the tooltip said "Sets whether the
window server creates a window device for the window immediately.
When YES, the window server defers creating the window device until
the window is moved onscreen."
No, this checkbox controls something else at a lower level, something
you shouldn't mess with.
I have to say, I'm not even sure why we have a checkbox for this in
IB...
Right now the reason I want to do this is that the contents of the
controls in the preferences windows can themselves be used to save
the preferences. For example I'd stick [backgroundColor color] in a
dictionary (where backgroundColor is a color well) instead of
managing my own NSColor * and responding to delegate methods.
If I read this correctly, you use the controls in your window as model
objects to store preferences that are accessed by other parts of your
application? If so, I'd suggest that this is a design flaw that you
should fix. The view objects in your application should not double as
model objects - See: The MVC design pattern.
j o a r
_______________________________________________
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
References: | |
| >awakeFromNib (From: David Harper <email@hidden>) |