Re: File's Owner
Re: File's Owner
- Subject: Re: File's Owner
- From: "Shawn Erickson" <email@hidden>
- Date: Fri, 23 May 2008 13:27:25 -0700
On Fri, May 23, 2008 at 11:49 AM, Johnny Lundy <email@hidden> wrote:
> I sent feedback on this as File's Owner is mentioned several times and not
> defined. There seems to be some huge problem with File's Owner. Even Aaron
> Hillegass says that people have trouble understanding File's Owner - and
> sure enough, when I read his explanation, I remained clueless.
So ask some questions (personally without all the banter and unneeded tone).
> I can follow making a generic NSObject set to my custom class, but why
> File's Owner?
You do this so Interface Builder knows what class the owner of the nib
will be so it can expose the correct outlets and actions when you
attempt to make connections to/from the file's owner proxy object with
other objects in the nib.
> That's all well and good, but what exactly is this thing?
It is a proxy object that allows objects instantiated in the nib to be
connected with an object outside of the nib, in this case the object
that has been specified as the owner of the nib when it was loaded.
So the real question you likely have is who is loading my nib? We can
only help answer that if you outline more about the nib and the code
involved. However as a guess I assume you are talking about
MainMenu.nib (default name for the "NSMainNibFile" entry that you
specify in your Info.plist). This nib is loaded by the NSApplication
instance the represents your Cocoa application (created when you call
NSApplicationMain() in you main entry point). NSApplication is the
owner of that nib, hence the file's owner proxy object represents it.
> Why would I succeed in having an outlet in my class if I set the Class Identity of
> File's Owner to my custom class?
Please restate since I don't follow the question.
> Why should I set File's Owner's Class
> Identity rather than the Class Identity of a plain NSObject that I drag out
> of the Library in IB?
See my first answer.
-Shawn
_______________________________________________
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
References: | |
| >File's Owner (From: Johnny Lundy <email@hidden>) |