按键对数组中的字典中的字符串进行排序?

时间:2012-09-06 22:05:10

标签: objective-c arrays dictionary plist sorting

我有一个plist文件,其中包含有关人员(姓名,职位,电话,电子邮件)的数据。这里有一个展示结构的样本,而不是解释:

 <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Kontakt</key>
    <array>
        <array>
            <dict>
                <key>title</key>
                <string>Teacher</string>
                <key>name</key>
                <string>Adam Scott</string>
                <key>phone</key>
                <string>tel://1234-567890</string>
                <key>email</key>
                <string>adam.scott@email.com</string>
            </dict>
            <dict>
                <key>title</key>
                <string>Teacher</string>
                <key>name</key>
                <string>Adam Scott</string>
                <key>phone</key>
                <string>tel://1234-567890</string>
                <key>email</key>
                <string>adam.scott@email.com</string>
            </dict>
            <dict>
                <key>title</key>
                <string>Teacher</string>
                <key>name</key>
                <string>Adam Scott</string>
                <key>phone</key>
                <string>tel://1234-567890</string>
                <key>email</key>
                <string>adam.scott@email.com</string>
            </dict>
        </array>
    </array>
</dict>
</plist>

在代码中,我想对键 名称 的字符串进行排序。然后我将在表视图中显示已排序的数组。有谁知道如何做到这一点?

0 个答案:

没有答案