Re: -windowDidLoad not getting called
Re: -windowDidLoad not getting called
- Subject: Re: -windowDidLoad not getting called
- From: Rick Mann <email@hidden>
- Date: Mon, 21 Apr 2008 17:34:20 -0700
On Apr 21, 2008, at 5:21 PM, Ken Thomases wrote:
Sometimes an NSWindowController is instantiated in a NIB as a
controller for a window in that same NIB. Other times, an
NSWindowController is outside the NIB that contains its window, and
is used to load that NIB.
I suspect that -windowDidLoad is only called in the latter case.
Read the description of the -window and -loadWindow methods, which
describes how -windowDidLoad is called.
In the former case, the NSWindowController isn't initialized with a
NIB. It's just initialized with -init, which is presumably a cover
for -initWithWindow:nil. Then, the NIB loading machinery calls its -
setWindow: method to connect the outlet. At some later point, you
call -window but the window is already "loaded" in the sense that
it's set, so -window doesn't call -loadWindow and friends.
Thanks for the answer.
That's all a rather unfortunate inconsistency (and part of why I sit
here learning Cocoa and thinking, "I thought Cocoa was supposed to be
this great thing").
I basically want my controller to go do some stuff after it and the
window are loaded. -setWindow seems like an ugly place to do this, and
-init is probably too early. Is there a better place?
--
Rick
_______________________________________________
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