FROM : Shawn Erickson
DATE : Tue Jan 29 18:16:51 2008
On Jan 29, 2008 8:48 AM, John Newlin <<email_removed>> 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
DATE : Tue Jan 29 18:16:51 2008
On Jan 29, 2008 8:48 AM, John Newlin <<email_removed>> 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
| Related mails | Author | Date |
|---|---|---|
| John Newlin | Jan 29, 17:48 | |
| Shawn Erickson | Jan 29, 18:16 |






Cocoa mail archive

