Re: Retaining non-document windows
Re: Retaining non-document windows
- Subject: Re: Retaining non-document windows
- From: Quincey Morris <email@hidden>
- Date: Wed, 04 Jan 2017 16:16:07 -0800
- Feedback-id: 167118m:167118agrif8a:167118sbnzE56YVL:SMTPCORP
On Jan 4, 2017, at 14:11 , Jean-Daniel <email@hidden> wrote:
>
> When using storyboard, the only way to instantiate window is by getting a reference to the window controller (by using -instantiateControllerWithIdentifier:), so it should not be an issue.
The problem I was referring to is when the window [scene] is in the initial controller. There’s no way (AFAIK) that you can statically set up a reference to the WC in any combination of IB/code, and of course the storyboard instantiation is not in your code.
Again AFAIK, you can get a reference to this WC from the window, and you can get the [main] window from the NSApplication object, or from a view controller’s view, but all of these things require you to defer getting the reference until the objects are created and functional.
Or, you can subclass NSWindowController, and have the windowDidLoad override add a controller reference to data structures somewhere.
But I think the old days when the template project provided a window controller property on the app delegate for you are gone.
Of course, I’d be extremely happy to be wrong about this. (I assume the tea leaves indicate that window controllers are on the way out, so don’t get too used to them.)
_______________________________________________
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