Re: Cross XIB references?
Re: Cross XIB references?
- Subject: Re: Cross XIB references?
- From: Matt Neuburg <email@hidden>
- Date: Sun, 06 Jun 2010 07:12:22 -0700
- Thread-topic: Cross XIB references?
On Sun, 06 Jun 2010 08:19:06 +0100, Jean-Fran?ois Brouillet <email@hidden>
said:
>I am *NOT* querying about how to create some object graph *programatically*,
>but how it is possible, if at all, to "control drag" from one object's outlet
>in nib#1 to some other target in nib#2 USING INTERFACE BUILDER.
It isn't, nor would it make sense to do so. There are no real objects in a
nib; there are the names of classes along with instructions on how to
instantiate those classes each time the nib is loaded. You can make an
outlet from one object to another within the nib because they will all be
instantiated together each time the nib is loaded. But an object in another
nib might never be instantiated. Or it might be instantiated 1000 times. So
a connection such as you describe would be meaningless.
Thus it is up to you to organize your architecture so that particular
instances that need to see each other can see each other when they both
actually exist.
> Please, prove me wrong and point me to that FAQ :-)
You're wrong in the sense that you don't seem to know what a nib is. But
now, I hope, you do. :)
> Now in *another* nib file I have *another* controller and I wanted to tell it:
> "BTW the image you want is in nib file 1, object id 789"
That makes no sense because no one would (or could?) keep an *image* in a
nib file. An image is not the name of a class; it is a real thing, a
resource, an asset; it would be in the app bundle and you'd refer to it with
imageNamed: or similar.
Also let's make sure you understand about the file's owner. Every nib file
has an owner when it is loaded. The owner is an instance that already exists
before the nib is loaded, and it is represented inside the nib by a proxy
object. That's why you can have outlets to or from the file's owner even
though it isn't instantiated from the nib. So if the same object needs to
see stuff that comes from two different nibs, you could make it the owner /
loader of both nibs - though that would be very unusual. A better way is to
start with two instances that can see each other and have one load nib 1 and
the other load nib 2. Another possible architecture is that nib 1 is loaded
and one of the resulting instances then loads and is owner for another nib -
so now that instance, which was instantiated by loading of nib 1, can have
outlets to things instantiated by loading nib 2.
m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings
_______________________________________________
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