Re: File's owner quetion
Re: File's owner quetion
- Subject: Re: File's owner quetion
- From: "Shawn Erickson" <email@hidden>
- Date: Tue, 29 Jan 2008 09:16:51 -0800
On Jan 29, 2008 8:48 AM, John Newlin <email@hidden> wrote:
> I'm new to Cocoa, so sorry for what is probably a simple question: :)
>
>
> I seem to have stumbled on a behavior that I guess should have been
> obvious, but was not obvious (at least to me) from the documentation.
> If I do the following:
>
> - I create a nib file, and set the class of File's Owner to
> "MyGreatClass"
> - Create an instance of MyGreatClass e.g. [[MyGreatClass alloc] init]
> - Call a method that then opens the above nib file.
>
> The outlets in "MyGreatClass" seem to become automatically connected
> to their counterparts in the nib. For example if I have an
> NSTextField outlet in "MyGreatClass", and connect it that to a real
> field in IB, when I open the nib file this connection is automatically
> made.
>
> So here's the dumb question: Is that what is supposed to happen? ;)
<http://developer.apple.com/documentation/Cocoa/Conceptual/LoadingResources/CocoaNibs/chapter_3_section_3.html#//apple_ref/doc/uid/10000051i-CH4-DontLinkElementID_7>
> And second quetion: What happens if a method in "SomeOtherClass"
> opens the nib file whose File's Owner is "MyGreatClass". Will an
> instance of "MyGreatClass" be created, and if so how does one get
> handle/pointer to that instance. Or is what I'm doing the expected
> way to work, where I first create an instance of the class, and then
> have a method in that class open the nib file?
When you load a nib you provide it an instance of the object to use as
the files owner.
<http://developer.apple.com/documentation/Cocoa/Conceptual/LoadingResources/CocoaNibs/chapter_3_section_6.html#//apple_ref/doc/uid/10000051i-CH4-DontLinkElementID_12>
-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