• 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: Newbie Q: How to implement multiple views occupying the same space?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie Q: How to implement multiple views occupying the same space?


  • Subject: Re: Newbie Q: How to implement multiple views occupying the same space?
  • From: Gore <email@hidden>
  • Date: Fri, 18 Jan 2002 11:45:25 +0200

On Friday, January 18, 2002, at 10:12 , email@hidden wrote:

Hey,
Thanks for the tip and the quick response,

On Friday, January 18, 2002, at 02:22 AM, Gore wrote:

the best way to do this is to use a NSBox and setContentView:, in your nib you shall have some NSViews in your instance window and have a outlet connection to them. Then, when you get a action message from the popup button, get the tag from the sender-id and put it in a switch (), and then load the proper view into the box, like this (remember to add a tag number to each menu item in IB):

- (IBAction)changeContentView:(id)sender
{
switch ( [sender tag] ) {
case 1:
[myBox setContentView: myView];
break;
...
}
}

Ok, but physically, in InterfaceBuilder, where do I put the NSViews in the window?? Do I just drag them to some location outside the Window's visible bounds so they can't be seen??

drag a NSView instance from the panel directly into the instance window (where First Responder and File Owner are located), it will popup a window that you can resize and so...that's the NSView, then drag your content into the NSView window and save the project =), but remember to add an outlet connection from your controller to the NSView instance so that you can do the [myBox setContentView: myView]; call...where myBox is your NSBox and myView is the NSView instance you have in your instance window in IB.

there is a example showing this in the "Learning cocoa" book.

I'll have to get my hands on it.

Thanks again,

Here is the link to the example-archive file from the book:
http://examples.oreilly.com/learncocoa/examples.sit

download it and have fun!

email@hidden


  • Prev by Date: Displaying ICON for Device in Finder
  • Next by Date: Re: Output from NSTask and modal window
  • Previous by thread: Re: Displaying ICON for Device in Finder
  • Next by thread: Re: Newbie Q: How to implement multiple views occupying the same space?
  • Index(es):
    • Date
    • Thread