objective-c-sort-keys-of-nsdictionary-based-on-dictionary-entries

时间:2022-08-23 19:38:27
NSArray *keys = [someDictionary allKeys];
NSArray *sortedKeys = [keys sortedArrayUsingComparator:^NSComparisonResult(id a, id b) {
NSString *first = [someDictionary objectForKey:a];
NSString *second = [someDictionary objectForKey:b];
return [first compare:second];
}]; http://*.com/questions/11554780/objective-c-sort-keys-of-nsdictionary-based-on-dictionary-entries