Re: windowDidLoad Not Called
Re: windowDidLoad Not Called
- Subject: Re: windowDidLoad Not Called
- From: Bill Cheeseman <email@hidden>
- Date: Mon, 12 Apr 2004 08:17:16 -0400
on 2004-04-12 5:52 AM, Scott Anguish at email@hidden wrote:
>
On Apr 11, 2004, at 2:04 AM, Mike Sheffield wrote:
...
>
> I have a trivial problem that I'm sure someone will be able to
>
> identify quickly, but is driving me mad. I have a simple (non
>
> document-based) Cocoa application. It has one window that is displayed
>
> when the window starts. I have an NSWindowController subclass
>
> instantiated in my nib file, and this class is set to be the
>
> controller for the main window....
>
Hrm.. that seems like an odd design pattern there, at least one I'd
>
never thought about....
I do it this way in my non-document-based applications, when I want the
file's owner to be NSApplication. Works like a charm.
>
> The call to [self window] causes the windowDidLoad method to be
>
> called. After this method exits, the controller's init method is
>
> called again. When it once again executes the [self window] method,
>
> windowDidLoad is called, after which init runs again. And so on. If I
>
> comment out the NSLog line, windowDidLoad is never called.
>
>
Yes.. this is correct actually...
I routinely call [self window] to force the window to load, but I don't do
it in the -init method. I do it in -awakeFromNib or in an action method to
load a secondary window (such as a preferences window). I've never
encountered any circularity. I wonder if that's happening because you have
it in an NSLog call?
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
The AppleScript Sourcebook -
http://www.AppleScriptSourcebook.com
Vermont Recipes -
http://www.stepwise.com/Articles/VermontRecipes
_______________________________________________
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.