Xcode按特定(NSString)字典键排序数组(如sql查询)

时间:2014-06-26 01:22:51

标签: sql arrays xcode sorting nssortdescriptor

例如,我想根据" fruit"对以下数组进行排序。按橙子,猕猴桃,苹果,芒果的顺序排列。之后,数组排序遵循相同的" fruit"中的名称升序。

    <__NSArrayM 0x8aaaaa0>(
{
    "unique" = 1;
    "fruit" = "apple";
    "name"  = "James";
},{
    "unique" = 2;
    "fruit" = "apple";
    "name"  = "Jason";
}, {
    "unique" = 3;
    "fruit" = "orange";
    "name"  = "Peter";
} ,{
    "unique" = 4;
    "fruit" = "kiwi;
    "name"  = "Amy";
} ,{
    "unique" = 5;
    "fruit" = "kiwi";
    "name"  = "Lionel";
} ,{
    "unique" = 6;
    "fruit" = "mango";
    "name"  = "Jacky";
} 

0 个答案:

没有答案