Re: Canonical way of loading compound UI components from a NIB into some other UI?
Re: Canonical way of loading compound UI components from a NIB into some other UI?
- Subject: Re: Canonical way of loading compound UI components from a NIB into some other UI?
- From: Luke Evans <email@hidden>
- Date: Wed, 5 Dec 2007 16:55:03 -0800
Thanks for the comments so far.
On reflection, I guess I'm trying to do something that I feel ought to
be a simple encapsulation of a compound custom control that I can
simply drag into interfaces and expect to have all the content
instantiated - much as the compound palette items in IB work. I'm not
so interested in loading individual parts of the UI at runtime (as one
would be if one was dynamically replacing parts of the view tree for
some requirement in the application).
Thus, it would be nice if Interface Builder had a proxy view that
represented the automatic loading of a NIB, replacement of the
placeholder/proxy with a named view in the NIB, and automatic setting
up of the size and owner of this view to match information on the proxy.
The tip on NSViewController was useful though (thanks), and this led
me to the Apple sample project "SourceView", which is certainly a
great pattern if it was my intention to build a dynamic interface that
swaps part of the view tree in and out. I note however that this
approach still keeps a 'connection point' custom view in the permanent
part of the view tree, and adds/removes the root of the changeable
part of the view tree underneath that. I could certainly use this
technique to load my unitary subtree as a child beneath a placeholder
view, but this was partly what I was trying to avoid (given that this
represents a redundant part of the view tree - if you have a perfectly
good root view for the compound control you are loading from separate
Nib).
So, my current thinking has evolved to a couple of possibilities:
1. Research how Interface Builder 3.0 supports plug-ins. This might
be overkill and require a lot of work, but in many ways this is what
I'm trying to do, i.e. build a more abstract, compound control that I
can just drag into other interfaces to get a 'static instance' copied
in.
2. Examine the possibility of creating the sort of "view loader" proxy
view that I've outlined above, which would enable me to drag a
correctly located/sized placeholder into interfaces with appropriate
properties to have the view hierarchy from a named NIb swapped in when
the proxy's -awakeFromNib is called.
-- Lwe
_______________________________________________
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