Re: programmatically instantiating bound view/controller
Re: programmatically instantiating bound view/controller
- Subject: Re: programmatically instantiating bound view/controller
- From: "Diez B. Roggisch" <email@hidden>
- Date: Sat, 02 Feb 2008 20:25:03 +0100
Kyle Sluder schrieb:
On Feb 2, 2008 2:05 PM, Diez B. Roggisch <email@hidden> 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
_______________________________________________
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