Skip to content

Instantly share code, notes, and snippets.

@Nub
Created October 9, 2011 08:56
Show Gist options
  • Select an option

  • Save Nub/1273470 to your computer and use it in GitHub Desktop.

Select an option

Save Nub/1273470 to your computer and use it in GitHub Desktop.
Apple example
NSArray *sortedArray = [array sortedArrayUsingComparator: ^(id obj1, id obj2) {
if ([obj1 integerValue] > [obj2 integerValue]) {
return (NSComparisonResult)NSOrderedDescending;
}
if ([obj1 integerValue] < [obj2 integerValue]) {
return (NSComparisonResult)NSOrderedAscending;
}
return (NSComparisonResult)NSOrderedSame;
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment