Re: windowDidLoad not getting called
Re: windowDidLoad not getting called
- Subject: Re: windowDidLoad not getting called
- From: Ken Thomases <email@hidden>
- Date: Thu, 19 Mar 2015 16:29:31 -0500
On Mar 19, 2015, at 3:39 PM, Bill Cheeseman <email@hidden> wrote:
> I believe you're mistaken when you say that the "Visible at Launch" setting doesn't result in a call to -windowDidLoad. I'm using it now in a rewrite of my UI Browser product, and it triggers -windowDidLoad exactly as I expected.
A window controller doesn't load its NIB unless and until something requests its window. That — the loading of the NIB — is what triggers the -windowDidLoad call. It is called whether or not the window is marked Visible at Launch.
Marking the window Visible at Launch obviously can't trigger the loading of the NIB, since it's a setting that's stored in the NIB.
> I don't see anything in my code that would trigger it.
Whatever is in your code that's making the window controller load its window is what's triggering the call it -windowDidLoad. This is all clearly documented in the NSWindowController class reference.
> When I turn off the nib setting the window does not appear at all, let alone call -windowDidLoad.
I can believe that the window does not appear because you evidently don't call -showWindow: on the controller or request its window and invoke -makeKeyAndOrderFront: on that.
Frankly, I don't believe you that -windowDidLoad is not called. I never set Visible at Launch on my windows (and turn it off it if it was set by default) and rely on -windowDidLoad being called. And it is.
> I've been following the "Visible at Launch" story since at least 2002, and I don't recall ever hearing a suggestion that it doesn't trigger -windowDidLoad.
Visible at Launch simply has nothing to do, one way or another, with whether -windowDidLoad gets called. Since Dave was calling -loadWindow rather than -window or -showWindow:, -windowDidLoad was not getting called. You suggested that setting Visible at Launch would change this. It does not.
I was not suggesting that setting Visible at Launch would break things or cause -windowDidLoad to not be called. It just wouldn't address the problem being discussed.
Regards,
Ken
_______________________________________________
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