Created
October 7, 2013 07:45
-
-
Save anddam/6863971 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma mark SORTING FUNCTIONS | |
NSInteger sortData(id num1, id num2, BOOL ascending) | |
{ | |
float v1 = [[num1 objectAtIndex:0] floatValue]; | |
float v2 = [[num2 objectAtIndex:0] floatValue]; | |
if (v1 < v2) | |
return (ascending ? NSOrderedAscending : NSOrderedDescending); | |
else if (v1 > v2) | |
return (ascending ? NSOrderedDescending : NSOrderedAscending); | |
else | |
return NSOrderedSame; | |
} | |
NSInteger sortDataAscending (id num1, id num2, void *context) { | |
return sortData(num1, num2, YES); } | |
NSInteger sortDataDescending (id num1, id num2, void *context) { | |
return sortData(num1, num2, NO); } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment