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 PROTECTED]



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to