问题
For example I want to sort following array based on "fruit" in the sequence of orange, kiwi, apple, mango. After that the array sort follow the ascending sequence of name among the same "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";
}
来源:https://stackoverflow.com/questions/24421071/xcode-sort-array-by-specific-nsstring-dictionary-key-like-sql-query