Gia*_*cio 1 sorting objective-c nsarray
如何以相反的顺序在数组中订购这些值?
_gradientArrayToWhite = [[NSArray alloc] initWithObjects:@"1", @"2", @"3", @"4", @"5", @"6", @"7", @"8", @"9", @"10", nil];
Run Code Online (Sandbox Code Playgroud)
使用NSArray的一种排序方法
NSArray * sorted = [_gradientArrayToWhite sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) {
return [obj1 integerValue] < [obj2 integerValue];
}];
Run Code Online (Sandbox Code Playgroud)