Re: Newbie Q: How to implement multiple views occupying the same space?
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 09:22:41 +0200
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;
...
}
}
there is a example showing this in the "Learning cocoa" book.
On Friday, January 18, 2002, at 09:08 , email@hidden wrote:
Hi,
I'd like to implement a set of views controlled by an NSPopUpButton
or a panel of icons similar to the Network preferences panel or the
System Preferences panel where the bottom (part) of the view is
completely replaced based on your selection in the popup button. Can
this be done with nib files and InterfaceBuilder? or do I have to
manually build up a bunch of subViews (no nib files - <sniffle>) and
call [NSView replaceViewWith: <view-user-picked>] everytime the user
picks a new one (bleah).
So far, everything else in Cocoa has seemed incredibly easy using nibs,
so I find it hard to believe that there isn't some really easy way to
accomplish this task as well. What am I missing?? Can you make a nib
file that has disembodied (disenwindowed?) NSView subclasses in it??
Thanks,
email@hidden
P.S. Is there a Cocoa FAQ?? I mean, somewhere besides
http://beowulf-
underground.org/doc_project/cocoa/cocoa.html
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.