Re: Hiding tab view items
Re: Hiding tab view items
- Subject: Re: Hiding tab view items
- From: Kyle Sluder <email@hidden>
- Date: Wed, 21 Oct 2009 00:23:06 -0700
On Wed, Oct 21, 2009 at 12:02 AM, BareFeet <email@hidden> wrote:
> This seems like a common requirement, so I keep thinking I must be missing
> something simple.
Nope. You're going to need to write code. The "hardest" part is
replacing the tab view items; this really isn't that difficult:
// Typed in Mail
- (void)updateTabView:(NSTabView *)tabView withItems:(NSArray *)newItems;
{
NSArray *oldItems = [tabView tabViewItems];
NSInteger newLocation = 0;
for (NSTabViewItem *newItem in newItems) {
NSInteger existingLocation = [tabView indexOfTabViewItem:newItem];
if (existingLocation != NSNotFound)
[tabView removeTabItem:newItem];
[tabView insertTabViewItem:newItem atIndex:newLocation++];
}
for (NSTabViewItem *oldItem in oldItems)
if (![newItems containsObject:oldItem])
[tabView removeTabViewItem:oldItem]
}
--Kyle Sluder
_______________________________________________
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