數組排序

1、使用sortedArrayUsingSelector

NSArray *array = @[@“天”,@“地”,@“玄”,@“黃”,nil];

NSArray *array1 = [array sortedArrayUsingSelector:@selector(compare:)];

2.block方式排序

[array sortedArrayUsingComparator:^NSComprisonResult(id object1,id object2){

NSComparisonResult retuslt = [obj1 compare:obj2];

Return retuslt;

];

原文地址:https://www.cnblogs.com/zuozeing/p/3616810.html