• 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
Re: Question about "swappable" views
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about "swappable" views


  • Subject: Re: Question about "swappable" views
  • From: Gideon Tearle <email@hidden>
  • Date: Wed, 31 Oct 2001 08:39:29 +0000

On Wednesday, October 31, 2001, at 01:06 , Mason Mark wrote:

2) Drag another "Custom View" from the palette into your nib document window (the window which shows the File's Owner, First Responder, etc). This is what Vince was talking about.

3) Double click this new custom view, fill it up with whatever UI stuff you need for one of your "swappable" views.

4) For whatever object in your nib file is serving as controller (e.g. your window controller or some other controller object instantiated in the nib), make sure that it has an outlet for each custom view you need. Ctrl-drag a connection from the controller to the new custom view you just created and hook it up to the appropriate outlet.

5) Repeat steps 2-4 for each custom view you need. Then you can define a single method to switch among the custom views, which does something like

[theSuperview replaceSubview:currentCustomView with:newCustomView];

That way, you can have more than one custom view in your single nib file. (If your custom views were numerous or complex, it might be desirable to separate them into multiple nib files that get loaded on demand, but your scenario seems simple.)

For ease of management and connection, you might also want to consider using an 'invisible' NSTabView... this is just like a normal tab view except that the tabs don't show up: you can change which view is selected programatically using

[tabView selectTabViewItemAtIndex:...]

or

[tabView selectTabViewItemWithIdentifier:...]

Best wishes

-- Gideon


  • Prev by Date: NSBrowser matrix question
  • Next by Date: Re: Changing the header size of a NSTableView
  • Previous by thread: Re: Question about "swappable" views
  • Next by thread: Re: Question about "swappable" views
  • Index(es):
    • Date
    • Thread