Re: re-making connections with a different controller
Re: re-making connections with a different controller
- Subject: Re: re-making connections with a different controller
- From: Quincey Morris <email@hidden>
- Date: Tue, 9 Jun 2009 21:44:16 -0700
On Jun 9, 2009, at 19:50, Stephen Blinkhorn wrote:
If you must use a tab view, you could also approach it with a view
xib and a view controller to define the common part of each tab.
The view controller would act as an intermediary to pass the action
methods on to the correct controller. (The details, and
feasibility, of this approach might depend on exactly what class of
controllers you're trying to use.)
That sounds interesting but will involve a near complete overhaul.
Are you sure? Moving the contents of the tabs to a different xib file
(or is it xib files? are all the tabs identical in appearance?) is
straightforward. Connecting the individual controls to the view
controller (File's Owner) is straightforward. Writing intermediary
action methods in your view controller subclass to pass the actions on
the correct controller (held in an instance variable, or set as the
representedObject) is straightforward.
The only real work happens in (say) your window controller's
awakeFromNib method. In that method, you would create as many view
controllers as there are distinct tabs, passing the correct action
controller object as a parameter, and letting the view controller
instantiate its nib. Then, for each view controller, replace the
appropriate tab subview with the view controller's view.
That doesn't require any design changes anywhere else in your
application, AFAICT. It also has the advantage of making your life
really easy if you ever have to add one more control to all of the tabs.
_______________________________________________
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