Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: -windowDidLoad not getting called




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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >-windowDidLoad not getting called (From: Rick Mann <email@hidden>)
 >Re: -windowDidLoad not getting called (From: Ken Thomases <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.