Re: File's owner in nib file
Re: File's owner in nib file
- Subject: Re: File's owner in nib file
- From: Seth Willits <email@hidden>
- Date: Sun, 08 Jun 2014 13:13:13 -0700
On Jun 8, 2014, at 12:23 PM, Seth Willits <email@hidden> wrote:
> Whether a window will appear or not has nothing to do with File's Owner. Your window is probably marked as "Release When Closed" in IB. It's shown once the first time, but after closing it it's deallocated and no longer exists so it can't be shown a second time. Turn that off.
Kyle pointed something out to me off-list, so now I need to backpedal and change what I said a bit.
What I meant was whether or not the File's Owner class in IB is set or not doesn't "really" matter to the issue at hand, but that's not true because if it's not set then you can't connect the window outlet of File's Owner (your window controller) to the window itself, which of course is critical.
So without setting it and connecting the window outlet, the window controller doesn't know about the window. The reason the window is being displayed the first time is probably because it has "Visible At Launch" checked, which will display the window when the nib loads ("Launch" is a misleading term, really). Once you've closed it, it can't be reopened because the window controller doesn't know it exists (because the outlet isn't connected) and thus can't tell it to display.
On Jun 8, 2014, at 12:28 PM, Miguel Carvajal <email@hidden> wrote:
>> When you load a nib, your code needs to access certain objects in the nib (via IBOutlets) and your nib may need to set properties (like delegates, data sources, and actions) to objects that exist outside of the nib. When you connect to "File's Owner", you're connecting from an object in IB to that object that already exists before nib is loaded.
>
> What does it means, the object that already exist before the nib is loaded? Do you refer in this case to NSWindowController instance?
Yes. The window controller itself exists before the nib is loaded. This is true of whatever "File's Owner" would be for any nib being loaded.
--
Seth Willits
_______________________________________________
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