Sort NSArray with custom object
2016-11-12 本文已影响0人
liwp_Stephen
Use sortedArrayUsingComparator
method to sort NSArray with custom object
NSArray *sortedArray = [list sortedArrayUsingComparator:
^NSComparisonResult(CustomObject *obj1, CustomObject *obj2){
return [obj1.attr1 compare:obj2.attr1];
}];