On Jun 6, 2010, at 2:19 AM, Jean-François Brouillet wrote:

>> • Subject: Re: Cross XIB references?
>> • User-agent: Microsoft-Entourage/12.23.0.091001
>> On Sat, 05 Jun 2010 22:14:22 +0100, Jean-Fran?ois Brouillet <em...@hidden>
>> said:
>>> So ... is there a way to refer to NIB1.objA from NIB2.objB ?
>> 
>> This is probably the most FAQ in the entire Cocoa universe, so check the
>> archives. But basically it's up to YOU to organize things so that there's a
>> chain of references that connects the instances you need connected.
> 
> Thanks Matt, but first I *did* Google left and right to no avail (but yes
> I have to admit that I didn't Bing :-), and judging by your answer it looks
> like you are talking about something I didn't ask.
> 
> 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.
> 
> Obviously IB does support some (so far as I have experienced: limited) form
> of cross nib references in the Attributes Inspector, but I haven't been able
> to make references to my "singleton" in NIB#1 from anywhere in NIB#2.

The point is that the only connections between the objects in any NIB and the 
rest of an application's object graph are through the placeholder/proxy objects 
like File's Owner and Application.

So, asking how to connect an object in one NIB to another is the same as asking 
how to connect it to anything else in your app.  You go through those 
placeholder/proxy objects and their properties.

For example, in most real-world cases, your NIB should not contain your model.  
Most NIBs other than MainMenu.nib don't even contain a coordinating controller 
(as opposed to mediating controllers).  And yet your View (in the MVC sense) 
does have a connection to the Controller and does, ultimately, reflect the 
state of the model.  So, how is that accomplished?  The answer is the same: 
through those placeholders and their properties.

To put it another way: you probably already know how to do what you seek, 
because you've already done it.  Not all of the connections you've established 
have been between objects in your NIB.  Some have been from objects in your NIB 
to objects outside of your NIB (File's Owner and Application).  You're asking 
about a special case of the same basic technique.

In short: no, you can't Control-drag from objects in one NIB to objects (or 
placeholders) in another.  If you think you need to, you're incorrect.

(I'd also point out that it would make no sense to do so.  A NIB may be loaded 
multiple times.  It does not represent a single object graph.  It represents a 
template of an object graph that can be reproduced at will.  So, what would 
such a cross-NIB connection actually mean?  Which objects would be connected to 
which other objects?)

Regards,
Ken

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to