Skip to content

Instantly share code, notes, and snippets.

@peterlee0127
Created August 22, 2013 16:52
Show Gist options
  • Save peterlee0127/6309860 to your computer and use it in GitHub Desktop.
Save peterlee0127/6309860 to your computer and use it in GitHub Desktop.
sorting
[modelsArray sortUsingSelector:@selector(myCompareMethodWithDict:)];
@interface GeofenceDataModel(myCompare)
- (NSComparisonResult)myCompareMethodWithDict: (GeofenceDataModel *) model;
@end
@implementation GeofenceDataModel (myCompare)
- (NSComparisonResult)myCompareMethodWithDict: (GeofenceDataModel *) model
{
NSNumber *place1 = [[NSNumber alloc] initWithFloat:self.distance];
NSNumber *place2=[[NSNumber alloc] initWithFloat:model.distance];
return [place1 compare: place2];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment