• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSDocument:windowControllerDidLoadNib && When are outlets connected to te loaded nib?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDocument:windowControllerDidLoadNib && When are outlets connected to te loaded nib?


  • Subject: Re: NSDocument:windowControllerDidLoadNib && When are outlets connected to te loaded nib?
  • From: Keith Renz <email@hidden>
  • Date: Mon, 9 Sep 2002 10:43:45 -0400

I know this is an old topic, but I recently ran into similar behavior, researched it, and found the following in the latest NSDocument.h file (not stated in the NSDocument reference doc):

- (void)windowControllerWillLoadNib:(NSWindowController *)windowController;
- (void)windowControllerDidLoadNib:(NSWindowController *)windowController;
// These methods are called when the nib loads if the document is the nib file's owner (ie if the document implements -windowNibName).

Assuming both NSDocument and NSWindowController are both subclassed, and NSWindowController's subclass is designated File's Owner (in the nib file) and all the init methods are correctly implemented (as Bill pointed out), windowControllerWillLoadNib: will never be called. In this case, the NSWindowController's subclass's override method windowDidLoad: will be called. In short, whatever subclass is designated as File's Owner will get the message. I also found the following in the latest NSWindowController.h file:

- (void)windowDidLoad;
- (void)windowWillLoad;
// These are called immediately before and after the controller loads its nib file. You can subclass these but should not call them directly. Always call super from your override.

I was not calling super in my override method and the header file clearly says to do so even though the NSWindowController reference doc says, "The default implementation does nothing." nor says anything about calling super.

So, it pays to read both the reference docs and the header files. I know Apple's busy and the docs are getting better, but hiding essential information in a header file is just plain silly.

Keith

-----

On Friday, August 16, 2002, at 11:24 AM, Bill Cheeseman wrote:

on 02-08-16 11:10 AM, Ondra Cada at email@hidden wrote:

On Friday, August 16, 2002, at 04:52 , Gerben Wierda wrote:

And more: at what moment can I trust that outlets in my
NSWindowController subclass are connected (have a non-nil value)?

Preferrably, in its -awakeFromNib.

But NSDocument's windowControllerDidLoadNib is available when you want the
document to notice that the nib loaded. It should work just as well as
awakeFromNib.

--

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
Croquet Club of Vermont - http://members.valley.net/croquetvermont
_______________________________________________
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.
_______________________________________________
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.

  • Prev by Date: Re: Tabbing into NSTableView finally solved!!
  • Next by Date: Re: Drawer size reverts to window size automatically. Why?
  • Previous by thread: Re: NSDrawer newbie question
  • Next by thread: Notifications of undoManager
  • Index(es):
    • Date
    • Thread