Re: NSTableView question!
Re: NSTableView question!
- Subject: Re: NSTableView question!
- From: Matt Gemmell <email@hidden>
- Date: Tue, 17 Jun 2003 13:46:04 +0100
On Tuesday, June 17, 2003, at 12:57 pm, Peter Karlsson wrote:
I have a NSTableView. And in the same NSTableView I want to show the
contents of 40 different NSMutable arrays. Not at the same time.
Can I store everything in 1 array and just show the right rows when my
buttons is pressed or must I have 40 different arrays? Or maybe there
is a better way to solve this?
You could store everything "flat" in one array, but that could become
needlessly difficult if you're adding and deleting items from each
"set" of values.
It would perhaps be easier to use an array of arrays, or a dictionary
of arrays. In any case, you'd just need to add logic to your
NSTableDataSource's methods to return the correct values depending on
which array you want to show.
You could probably just have an instance variable in your tableview's
datasource which kept track of which set of values you wanted to show
(maybe just an int, giving an index in the big array-of-arrays, or a
string giving a key for the big dictionary-of-arrays). Whenever the
user clicked one of your buttons to select a different set of data,
change that instance variable's value and tell your tableview to
-reloadData. Take a look at the NSTableDataSource documentation to see
the appropriate methods to implement.
Cheers,
-Matt
--
Matt Gemmell
Scotland Software
http://www.scotlandsoftware.com/
_______________________________________________
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.