Re: difference between windowDidLoad and awakeFromNib
Re: difference between windowDidLoad and awakeFromNib
- Subject: Re: difference between windowDidLoad and awakeFromNib
- From: email@hidden
- Date: Wed, 17 Jul 2002 05:50:06 +0200
On Dienstag, Juli 16, 2002, at 06:07 Uhr, Brian Webster wrote:
On Tuesday, July 16, 2002, at 10:12 AM, cocoa-dev-
email@hidden wrote:
I'd like to know the differences between windowDidLoad in
NSWindowController and awakeFromNib.
I believe the awakeFromNib method is only called on objects that are
actually archived in the nib file. A NSWindowController is created in
code and then loads its nib file programmatically. awakeFromNib will
be called on all the objects that are loaded in the nib file, but not
the window controller, because it already exists before loading the nib.
Actually, that's not correct. If you load a nib file with [NSBundle
loadNibNamed:@"bla" owner:foo] the object specified as owner will
always (!) be sent an awakeFromNib message, even if it is already
instantiated. (That means that an object can receive this message more
than once.)
With regard to the original question my (newbie) guess is that
awakeFromNib is used by NSWindowController to set up the window
(staggering, setting the title, ...). If you override it be sure to call
[super awakeFromNib]. Therefore it is probably better to follow the
documentation and initialize your stuff in windowDidLoad.
Best regards,
Stephan Bublava
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.