Using NSDictionary in datasource
Using NSDictionary in datasource
- Subject: Using NSDictionary in datasource
- From: James Gifford <email@hidden>
- Date: Wed, 14 Sep 2005 15:08:54 -0700
Hi all,
I've got a question concerning NSDictionaries and datasources.
I understand using an NSArray to hold a list of objects to populate
an NSTableView. However, I've got some data that I am currently
storing in an NSDictionary that I would like to use in my
datasource. My question is: should I use an NSDictionary or an array
of NSDictionaries, or an array of arrays?
My data is rather simple: I've got a bunch of NSStrings and for each
one there is an NSNumber indicating how often the string appears in
another datasource. So, for instance, I might have the pair "Bob"
and 3. Currently I am using the string as the key and the number as
the value for each entry in the dictionary. The problem is, I can't
figure out how to properly implement the datasource methods using a
dictionary. The -tableView:objectValueForTableColumn:row method
looks for data based on the index of the row, but how can I look up
data in an unordered dictionary based on an index value? I am just
looking for the most efficient way to store my data for use in the
datasource.
Any help at all would be much appreciated.
_______________________________________________
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