Skip navigation.
 
mlFile's owner quetion
FROM : John Newlin
DATE : Tue Jan 29 17:48:23 2008

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?  ;)

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?

I hope that makes sense, my English is not very good.  :)

-john

Related mailsAuthorDate
mlFile's owner quetion John Newlin Jan 29, 17:48
mlRe: File's owner quetion Shawn Erickson Jan 29, 18:16