Re: Newbie Question: NSTabView and NSTabViewItem
Re: Newbie Question: NSTabView and NSTabViewItem
- Subject: Re: Newbie Question: NSTabView and NSTabViewItem
- From: John Hörnkvist <email@hidden>
- Date: Wed, 9 May 2001 05:30:10 +0200
On Wednesday, May 9, 2001, at 04:41 AM, William Jamieson wrote:
What I've spent the last 2 days researching and can't figure out is how
can
I display and hide the information on the different screens when the
user
changes the selected tab. For example:
1. The user is currently on tab 1 and the screen shows all the fields
and
info relevant to the first tab.
2. Then the user clicks on tab 2.
How do I hide all the fields and info relevant to the first tab and the
show
all the fields and info relevant to the second tab????
The simple answer is that you don't. :)
It's the tab view's job to switch between the different subviews.
Each NSTabViewItem has a view associated with it. When switching, the
tab view just removes the current subview and adds the view from the
appropriate item.
Your job is just to create the NSTabViewItem's and add them to the tab
view, all of which InterfaceBuilder handles very well.
If you want to do it manually, it's fairly easy, too:
MyView* newView=[[[MyView alloc] initWithFrame:[tabView
contentRect]] autorelease];
NSTabViewItem* item=[[NSTabViewItem alloc]
initWithIdentifier:someIdentifier];
[item setLabel:someLabel];
[item setView:newView];
[tabView addTabViewItem:item];
Regards,
John Hornkvist
---
ToastedMarshmallow, the perfect Cocoa companion
http://www.toastedmarshmallow.com