• 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: awakeFromNib and windowWillLoad : basic question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: awakeFromNib and windowWillLoad : basic question


  • Subject: Re: awakeFromNib and windowWillLoad : basic question
  • From: Chris Hanson <email@hidden>
  • Date: Tue, 8 Jul 2003 13:06:50 -0500

On Tuesday, July 8, 2003, at 09:35 AM, jean Bousquet wrote:
Here are some practical rules I observed running simple tests :

Please don't just try to derive rules of thumb about how Cocoa behaves from observation. Read the documentation, it's all described in there.

1) The windowControllers of the windows both defined in the MainMenu.nib
file (no matter if the window is or not visible at launch time) never are
sent windowDidLoad (nor windowWillLoad).

Here's what should be going on:

(1) You have a subclass of NSWindowController that is instantiated in your MainMenu.nib file. Let's call this instance "MyWindowController".

(2) MyWindowController has its window outlet connected to an NSWindow that is also instantiated in your MainMenu.nib file. Let's call this window "MyWindow". MyWindow is *not* set to be initially visible.

(3) When your application is launched, MainMenu.nib is loaded and MyWindowController is sent -awakeFromNib.

(4) At some point, you send MyWindowController the -showWindow: action message. This should display MyWindow automatically, and MyWindowController should receive both -windowWillLoad and -windowDidLoad as part of that display process.

MyWindowController will *not* be sent -windowWillLoad and -windowDidLoad just because it was instantiated. It actually needs to be sent -showWindow: *and* have its window outlet connected to MyWindow. Furthermore, MyWindowController won't be sent -awakeFromNib again as it shows the window because it has already been instantiated and configured.

2) The windowControllers of the windows defined in another nib file
(different from the MainMenu.nib file), are sent a windowWillLoad, a
awakeFromNib, a windowDidLoad (in that order) each time there are
instantiated.

Probably because you're actually sending these window controllers -showWindow:.

-- Chris

--
Chris Hanson, bDistributed.com, Inc. | Email: email@hidden
Custom Application Development | Phone: +1-847-372-3955
http://bdistributed.com/ | Fax: +1-847-589-3738
http://bdistributed.com/Articles/ | Personal Email: email@hidden
_______________________________________________
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.

References: 
 >Re: awakeFromNib and windowWillLoad : basic question (From: jean Bousquet <email@hidden>)

  • Prev by Date: Re: NSString to int (or double) conversion
  • Next by Date: Re: Cannot declare variables in the middle anymore
  • Previous by thread: Re: awakeFromNib and windowWillLoad : basic question
  • Next by thread: Re: awakeFromNib and windowWillLoad : basic question
  • Index(es):
    • Date
    • Thread