标签:
NSArray *stringArray = [NSArray arrayWithObjects:@"fff 1", @"abc 21", @"abc 12",@"abc 13",@"abc 05",nil];
NSComparator sortBlock = ^(id string1, id string2)
{
return [string1 compare:string2];
};
NSArray *sortArray = [stringArray sortedArrayUsingComparator:sortBlock];
NSLog(@"sortArray:%@", sortArray);
Log 输出如下:
sortArray:(
"abc 05",
"abc 12",
"abc 13",
"abc 21",
"fff 1"
)
标签:
原文地址:http://www.cnblogs.com/fantasy3588/p/5560223.html