iOS 根据字母排序

NSDictionary *dic = @{@"devicetype":@"1",
@"hospital_id":@"2",
@"phone":@"3",
@"user_id":@"4",
@"hsnm":@"2",
@"njh":@"1",
@"hanm":@"2",
@"hbnm":@"2",
@"hcnm":@"2",
@"hdnm":@"2",
@"hmnm":@"2"};
NSArray *keyArray = dic.allKeys;
NSArray *sortArray = [keyArray sortedArrayUsingComparator:^NSComparisonResult(id _Nonnull obj1, id _Nonnull obj2) {
return [obj1 compare:obj2 options:NSNumericSearch];
}];

你可能感兴趣的:(iOS 根据字母排序)