2016-04-24 78 views

回答

0

排序中的iOS字典的數組是很容易簡單NSSortDescriptor做演練。

[yourArray sortUsingDescriptors:[NSArray arrayWithObjects:[NSSortDescriptor sortDescriptorWithKey:@"keyName" ascending:YES], nil]]; 
0

您可以使用sortedArrayUsingComparator

NSArray *sortedArray; 
sortedArray = [unsortedArray sortedArrayUsingComparator:^NSComparisonResult(id a, id b) { 
Dictionary *dictoinary1 = (Dictionary*)a; 
Dictionary * dictoinary2 = (Dictionary*)b; 
return [[dictoinary1 objectForKey:@"keyName"] caseInsensitiveCompare:[dictoinary2 objectForKey:@"keyName"]]; 
}]; 
相關問題