views:

516

answers:

1

Hi everyone,

I´m trying to use Interface Builder (IB) to gain time in my app development. So I´m trying to do new things, for example, connecting objects between File´s Owners and Controllers.

The situation is:

1 - I have a ViewController with a Nib. This view controller have an array set as a IBOutlet.

2 - I put a custom TableViewController inside the Nib. Inside this TableViewController I set another IBOutlet Array, that I want to put as cell values (I will do this inside my TableViewController.m).

3 - The quesntion is, is possible to connect the two IBOutlets Array? Or to create something like a "IBInlet"..? Or in Interface Builder you can just use the IBOutlets as connections to the Library Objects of Cocoa Touch..?

Thanks for everyone..!

A: 

First off, I think it's unclear if you're trying to have two pointers to the same Array object or if you actually want to have two Array objects which you keep in sync. The latter makes little sense as it will just double your memory usage with no benefit, so let's assume you just want to have two pointers to the same Array object.

IB will help you link a data structure (your Array object) to a compatible interface widget, but it's still up to you to initialize your data structures in your code. Following that line of thinking, you can use IB to link your Array in the appropriate controller to the widget which you manage in that controller. Independently from that you can have one controller initialize the object and the other controller can get a pointer to that object from the first controller. Just make sure you manage your retains correctly ;)

jharlap