• 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
Sorting an NSArray containing NSDictionaries
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Sorting an NSArray containing NSDictionaries


  • Subject: Sorting an NSArray containing NSDictionaries
  • From: email@hidden
  • Date: Tue, 28 Aug 2001 19:29:18 -0700

Hello all!

I have a little dictionary program in the works (for my studies, and to be a distraction from them), but I am having a little problem with sorting. The words are stored in a .plist file and I create an array from it.

Here's an excerpt from the plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
<array>
<dict>
<key>English</key>
<string>write</string>
<key>Latin</key>
<string>scribo</string>
<key>Type</key>
<string>verb</string>
</dict>
<dict>
<key>English</key>
<string>writing</string>
<key>Latin</key>
<string>sriptum</string>
<key>Type</key>
<string>noun</string>
</dict>
// the dictionaries continue //
</array>
</plist>


I get the data into an array with no problem, and can access all the data within. But when I add a word, it isn't in alphabetical order, but I want it to be in the table view. In short, what I need to do is sort an array based on what is in dictionaries that are contained within. It would be best if I could sort by the english word.

If this made no sense to you, it's my fault as I am horrible at explaining these types of things; just ask if you need more info.

Thanks,
Sam


  • Follow-Ups:
    • Re: Sorting an NSArray containing NSDictionaries
      • From: Ondra Cada <email@hidden>
  • Prev by Date: Another Cocoa Bug!!
  • Next by Date: (no subject)
  • Previous by thread: Another Cocoa Bug!!
  • Next by thread: Re: Sorting an NSArray containing NSDictionaries
  • Index(es):
    • Date
    • Thread