Skip navigation.
 
mlRe: programmatically instantiating bound view/controller
FROM : Diez B. Roggisch
DATE : Sat Feb 02 20:25:03 2008

Kyle Sluder schrieb:
> On Feb 2, 2008 2:05 PM, Diez B. Roggisch <<email_removed>> wrote:

>> So the first question is: to make a re-usable view/panel, do I need to
>> create a IB Palette? I'd rather avoid that for obvious reasons (I doubt
>> I ever need that control again) - but will, if I have to.

>
> Nope.  You would typically create a new nib that contained just your
> view (no windows, just the view) and place your controls in it.  Your
> window controller (most likely) will be responsible for loading this
> nib (which instantiates a new view each time) and placing its view in
> the window's view hierarchy.


Ah, that sounds promising. I'll give that a shot.

>> The second question: once I found a way to create a panel, the question
>> of the number of instances arises.
>>
>> Granted, my robot wont magically grow any new motors over night, so I
>> _could_ go and instantiate a panel & controller for each of them.
>> However, I was wondering if there is a way to instantiate a panel + a
>> controller. As said above, providing a controller with a new
>> data-backing object seems to be easy, but I've got no idea if and how I
>> can re-create the bindings for my new panel instance.

>
> If you're going to go the multiple-window route (instead of multiple
> views in one window), then you should be able to bind through the
> File's Owner proxy object without issue.  There should be no need to
> recreate any bindings.



I'd rather go the multiple-views-in-one-window route- things will get
messy otherwise.

If using the NIB-approach, if there are ways to get the view (I never
did load a NIB myself so far, excuse my ignorance) shouldn't I be able
to get a reference to my NSObjectController as well? Then I'd set the
content on that.

> HTH,


It sure does!

Regards,

Diez B. Roggisch

Related mailsAuthorDate
mlprogrammatically instantiating bound view/controller Diez B. Roggisch Feb 2, 20:05
mlRe: programmatically instantiating bound view/controller Kyle Sluder Feb 2, 20:16
mlRe: programmatically instantiating bound view/controller Diez B. Roggisch Feb 2, 20:25
mlRe: programmatically instantiating bound view/controller Kyle Sluder Feb 2, 21:25