Sorting an NSArray containing NSDictionaries
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