Re: Safari-like View Change
Re: Safari-like View Change
- Subject: Re: Safari-like View Change
- From: Glenn Andreas <email@hidden>
- Date: Thu, 23 Sep 2004 10:52:38 -0500
At 10:14 AM -0400 9/23/04, Kevin Ballard wrote:
Well, yes, you can, but then you have to keep track of indexes for
things that aren't necessarily indexed. In my case, I have a list of
plugins, and a tableview that lets me select the one to show the
view for. The list in the tableview isn't necessarily the same list
I have internally for my plugins (since it can be sorted and there's
the potential of filtering out certain plugins), so instead I access
them by name (which is good because my internal plugin manager uses
names to access the components of the plugin). This would be much
more complicated if I had to use a tab view and access it by index.
Then, since you've got a name, you can use the tab view item identifier.
In more detail (for the archives), something like:
- (void) addViewFromPlugin: (MyPlugin *)plugin
{
NSTabltemView *tabItem = [[NSTabItemView alloc]
initWithIdentifier: [plugin name]];
[tabItem setView: [plugin view]];
[myTabView addTabViewItem: tabItem];
[tabItem release]; // we alloc/inited, we release
}
- (void) showViewForPlugin: (MyPlugin *)plugin
{
[myTabView selectTabViewItemWithIdentifier: [myPlugin name]];
}
I've found that 90% of the time when I think "well, I can't use Foo
because my program's architecture does things this way" it turns out
that Foo is probably general enough to support it after all (either
by identifiers, representedObjects, delegates, a simple NSDictionary,
etc...)
Now it sounds like you've obviously got a solution that works for
your needs, but hopefully in two weeks whem somebody wants to know
how to switch between a dynamic list of views using names, they'll
search the archives and find this thread. (It seems like almost any
question is asked again two weeks later by somebody else).
--
Glenn Andreas email@hidden
<http://www.gandreas.com/> oh my!
Mad, Bad, and Dangerous to Know
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden