Re: File's Owner
Re: File's Owner
- Subject: Re: File's Owner
- From: Steve Weller <email@hidden>
- Date: Fri, 23 May 2008 15:17:16 -0700
The hang up that I see is that this documentation give no clue as to
the reason for File's Owner's existence.
What problem does it solve?
Fundamentals mean nothing unless they read like a story: you have to
give each thing a reason to exist so that the reader has a place to
mentally hang them.
On May 23, 2008, at 12:13 PM, Matt Long wrote:
I'm trying to figure out why the big hang up on needing to
understand it fully. Not understanding it should not prevent you
from developing applications. So why the hangup? What is the actual
problem? Just set your own NSObject based app delegate as the File's
Owner delegate in IB and start adding your code to it. That's really
all you *need* to know.
-Matt
--------------------------
Matt Long
email@hidden
http://www.matthew-long.com/
On May 23, 2008, at 12:49 PM, Johnny Lundy <email@hidden>
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.
http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CommunicatingWithObjects/chapter_6_section_3.html
You connect an outlet in Interface Builder, but the procedure
starts in Xcode. The following steps describe the procedure:
When defining your custom class, declare an outlet by tagging the
instance variable with the IBAction qualifier.
In Interface Builder, drag a generic object into the top level of
the nib file window (if one doesn’t already exist for your custom
class).
If an instance of your custom class is to be the File’s Owner for
the nib file, this step is not necessary. Also, if you’re defining
a custom NSView object, select that object instead.
Import the custom class into Interface Builder.
With the generic object (or File’s Owner) selected, type the name
of your custom class in the Class field of the Identify pane of
the Interface Builder inspector. This assigns your custom class as
the class of the selected object. This step has to be done only
once.
Select your custom instance (or File’s Owner).
Right-click or Control-click this object to display the
connections panel.
Find your outlet under Outlets and drag a connection line from the
circle next to the outlet to the object on the user interface that
you want that outlet to reference.
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.
I can follow making a generic NSObject set to my custom class, but
why File's Owner?
My birthday is coming up and if I can understand File's Owner, I
will consider that one of the best presents.
As usual, I can recite the documentation without understanding it :
File's Owner is a proxy object that is set at nib load time to the
object that loaded the nib (I don't know what object loaded my nib,
so that does not help me). In MainMenu.nib, this is the application
instance, which is a shared singleton instance of NSApplication
(how all applications can share this is beyond me), which is also
set to the global variable NSApp (uhh, OK...).
That's all well and good, but what exactly is this thing? 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? 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
_______________________________________________
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
_______________________________________________
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