• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Best way to replace one view with another within a superview
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Best way to replace one view with another within a superview
      • From: Dave Hersey <email@hidden>
    • Re: Best way to replace one view with another within a superview
      • From: Matt Mashyna <email@hidden>
  • Prev by Date: Re: A couple questions relevant to games
  • Next by Date: Re: [Foo new] vs [[Foo alloc] init]:
  • Previous by thread: Re: indexForPage: page not found - Problem with PDFView on Tiger, works fine on Leopard
  • Next by thread: Re: Best way to replace one view with another within a superview
  • Index(es):
    • Date
    • Thread