字典 排序
#import <Foundation/Foundation.h> int main(int argc, const char * argv[]) { @autoreleasepool { //字典排序 NSDictionary *dic=@{@"1-1":@"02", @"1-2":@"11", @"1-3":@"98", @"1-4":@"7"}; NSArray *arr=[dic allValues]; for (id str in arr) { NSLog(@"%@",str); } arr=[arr sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) { return [obj1 compare:obj2]; }]; NSLog(@"排序后"); for (id str in arr) { NSLog(@"%@",str); } } return 0; }