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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to