Re: File's Owner
Re: File's Owner
- Subject: Re: File's Owner
- From: Brian Stern <email@hidden>
- Date: Fri, 23 May 2008 16:00:04 -0400
On May 23, 2008, at 2:49 PM, Johnny Lundy wrote:
I decided to once again go verbatim through Cocoa Fundamentals. So
far it has been largely "uh-huh, yep", but the File's Owner, my
nemesis, comes up again.
File's Owner is a title. It is similar, in a way, to the title:
President of the United States. Every four years Americans elect the
POTUS. The individual who is POTUS changes, the title remains the same.
Software development, in this case Cocoa, is not a democracy. You, the
developer, are absolute dictator of your code. You, the developer,
have the absolute power, and in fact the responsibility, to choose the
object that is the File's Owner for each nib in your application.
Why must you do this? What is the point of this title of File's Owner?
Consider the nibs in your application. They contain a description of a
UI with some number of views and other objects. When a nib is loaded
into your application this description is turned into a view hierarchy
of real objects, usually rooted in a NSWindow.
How can this newly created View hierarchy communicate with the rest of
the application, and visa versa? The answer is outlets. Where are the
outlets? In the File's Owner.
The object that has the outlets that are assigned to when the nib is
loaded can be of any kind. That's why the documentation calls File's
Owner a proxy. It's also why you must tell IB the Class of the File's
Owner for a given nib. The File's Owner icon in the IB window is
there so you can set the outlets and actions of it so that you can
make the connections between the new objects in the nib and the
already existing objects in the application. It's a representation, or
a title, of the real object that owns the nib.
--
Brian Stern
email@hidden
_______________________________________________
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>) |