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

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://stackoverflow.com/questions/11554780/objective-c-sort-keys-of-nsdictionary-based-on-dictionary-entries
posted @ 2015-11-24 11:21  lianhuaren  阅读(182)  评论(0编辑  收藏  举报