//1.全局创建排序block
NSComparator sortBlock = ^(id string1,id string2) {
return [string1 compare:string2];
};
//2. 创建数组
NSArray *stringArray = [NSArray arrayWithObjects:@100,@101,@300,@88,@77, nil];
//3.利用系统给定的方法引入block方法进行排序,默认排序方式是升序
NSArray *sortArray = [stringArray sortedArrayUsingComparator:sortBlock];
NSLog(@"sortArray = %@",sortArray);