• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Using NSDictionary in datasource
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: Using NSDictionary in datasource
      • From: John Stiles <email@hidden>
  • Prev by Date: Re: Question about floatValue on nil object
  • Next by Date: Using Spotlight to watch for file change
  • Previous by thread: Re: Help with crash in removeObserver:forKeyPath:
  • Next by thread: Re: Using NSDictionary in datasource
  • Index(es):
    • Date
    • Thread