Best way to replace one view with another within a superview
Best way to replace one view with another within a superview
- Subject: Best way to replace one view with another within a superview
- From: Timothy Mowlem <email@hidden>
- Date: Sun, 17 Feb 2008 23:04:10 +0000
Hello,
I am writing an application which has a GUI layout similar to the 3-
pane view used by iTunes, with a sidebar of categories on the left, an
object view in the top right hand corner and a details view for the
chosen objects in the bottom right hand corner. However the contents
of the top and bottom right hand views need to vary depending on the
current application state, e.g. the current selection in the left hand
pane.
In Java one would create a JPanel which contained the UI to be shown
in each state and then remove the old panel from its containing panel
and replace it with the new one programmatically when it needs to be
changed. Also in most cases the UI is constructed in code rather than
using a tool like IB.
However in Cocoa I can't see how to do this. There seem to be several
issues:
(1) controls are added directly to the window's content view rather
than to a panel like in Java
(2) IB doesn't seem to have any way to design several sets of
components as a group and be able to switch between them
Note that I don't want to use a tabbed pane here as the context may
completely change so tabs wouldn't really be appropriate. One solution
I can envision is a table with each view in a separate row of a single
column table and then scrolling the selection to show the required
view. But this seems like a hack and I haven't explored it.
I would like to ask for advice on the best way to do this in Cocoa/
Interface Builder? Its a fairly common design so presumably there are
one or more recommended approaches?
Thank you,
Timothy Mowlem
_______________________________________________
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