How to make the FileOwner of a nib file accessible globally in whole project (was Re: Cocoa-dev Digest, Vol 5, Issue 1168)
How to make the FileOwner of a nib file accessible globally in whole project (was Re: Cocoa-dev Digest, Vol 5, Issue 1168)
- Subject: How to make the FileOwner of a nib file accessible globally in whole project (was Re: Cocoa-dev Digest, Vol 5, Issue 1168)
- From: Andy Lee <email@hidden>
- Date: Tue, 1 Jul 2008 14:36:42 -0400
On Jul 1, 2008, at 2:07 PM, JArod Wen wrote:
I need to make some clearance on this problem: the biggest issue is
that MovieDocument is instantiated by IB, since it is the FileOwner
of the MovieDocument.nib. So the problem should be: is there a way
to access a class from a method of another class when the
first class is instantiated from a NIB file.
Either I am misunderstanding you or you are misunderstanding how
File's Owner works. File's Owner is *not* instantiated by loading the
nib.
Here's an explanation I gave earlier, with a few edits:
Unlike most other objects in a nib file (First Responder being the
other exception), File's Owner is not a specific object. It is a
placeholder for an "owner" object that will be specified when the
nib file is loaded by your program.
You edit a nib file knowing the file will be loaded at some point
when your program is running, and *at that future time* you will
specify the owner of the file (hence "File's Owner" -- it's the
second argument to loadNibNamed:owner:). It will be an object that
your program created prior to loading the nib.
The File's Owner gives your program access to the objects in the nib
file, through the connections you made to it in the nib.
So making your MovieDocument object visible to other classes isn't
really affected by the fact that it's a File's Owner for a nib. You
can use any of the techniques you'd normally use in code to make one
object visible to another.
Note also that a given object can be File's Owner for more than one
nib, if that helps.
--Andy
_______________________________________________
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