1. 程式人生 > >iOS -轉載-根據字母排序

iOS -轉載-根據字母排序

1.從小到大自然排序
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]; }];