• 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: -windowDidLoad not getting called
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: -windowDidLoad not getting called
      • From: Chris Hanson <email@hidden>
    • Re: -windowDidLoad not getting called
      • From: Jeff Nouwen <email@hidden>
References: 
 >-windowDidLoad not getting called (From: Rick Mann <email@hidden>)
 >Re: -windowDidLoad not getting called (From: Ken Thomases <email@hidden>)

  • Prev by Date: Where is mach_port_deallocate()?
  • Next by Date: Re: How to import drawing paths into a Cocoa application?
  • Previous by thread: Re: -windowDidLoad not getting called
  • Next by thread: Re: -windowDidLoad not getting called
  • Index(es):
    • Date
    • Thread