#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSMutableArray* array = [NSMutableArray arrayWithObjects:@"6",@"34",@"56",@"78",nil];
NSComparator sortBlock =^(id obj1,id obj2)
{
int object1 = [obj1 intValue];
int object2 = [obj2 intValue];
if(object1<object2)
{
return NSOrderedDescending;
}
else if (object1==object2)
{
return NSOrderedSame;
}
else
{
return NSOrderedAscending;
}
};
NSArray* sortArray = [array sortedArrayUsingComparator:sortBlock];
NSLog(@"%@",sortArray);
}
return 0;
}