Re: Creating, Constructing and Managing Dynamic (Sub)Views
Re: Creating, Constructing and Managing Dynamic (Sub)Views
- Subject: Re: Creating, Constructing and Managing Dynamic (Sub)Views
- From: Graham Cox <email@hidden>
- Date: Thu, 28 May 2009 16:33:52 +1000
On 28/05/2009, at 2:34 PM, Grant Erickson wrote:
is it best to have a NIB for each subview or pack them all into
a single NIB?
I'd say put all the subviews into the same nib. It makes it much
easier to select among them because you can have a single master
controller that has outlets for each subcontroller. You can also
instantiate each subcontroller in the nib and connect up all the
individual controls for each subview.
Switching them in and out could be done with a tabless tabview, but
it's also very easy to write code that inserts and removes the
subviews. This code can be made generic and not requiring modification
if you add further types of subview by choosing a naming convention
for your outlets and taking advantage of valueForKey:'s ability to
discover ivars by name.
KVO and bindings can further reduce the code needed to implement the
view/controller handling. With care it can be boiled down to just a
few lines of code.
--Graham
_______________________________________________
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