Re: window loading sequence
Re: window loading sequence
- Subject: Re: window loading sequence
- From: matt neuburg <email@hidden>
- Date: Mon, 30 Dec 2002 18:19:06 -0800
On Mon, 30 Dec 2002 15:41:17 -0500, Carrie Brezine <email@hidden> said:
>
Hi, I'm wondering if someone could please point me to a clear
>
explanation of the order in which methods are called when a nib is
>
loaded. After many false steps I've figured out that -awakeFromNib
>
comes after -windowDidLoad, but I don't know how many other things
>
there might be before/after/inbetween those two
I know this is going to sound unhelpful and glib, but my advice genuinely is that if you think you need to know this you're doing something wrong. Your code should not be depending upon these calls coming in any particular order. -awakeFromNib and -windowDidLoad are very different calls with very different purposes; those purposes are pretty clearly documented and it should be clear from that where to put your code.
One thing that might be helpful to know, and that is NOT as well documented as it might be, is that telling an NSWindowController to initWithWindowNibName does not actually load the window. Nothing happens until you *refer* to the window. Thus, if you're in doubt, you can simply have a routine start with this line:
[self window];
This does nothing except to make darned certain that the window is loaded before proceeding. So for example my -awakeFromNib in an NSWindowController that is itself instantiated in a nib often starts with this line. m.
matt neuburg, phd = email@hidden,
http://www.tidbits.com/matt
pantes anthropoi tou eidenai oregontai phusei
Subscribe to TidBITS! It's free and smart.
http://www.tidbits.com/
_______________________________________________
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.