Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- NSArray *sortedArray = [drinkDetails sortedArrayUsingSelector:@selector(???)];
- - (NSComparisonResult)compare:(Person *)otherObject {
- return [self.birthDate compare:otherObject.birthDate];
- }
- NSArray *sortedArray = [drinkDetails sortedArrayUsingSelector:@selector(compare:)];
- NSSortDescriptor *sortDescriptor;
- sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"birthDate"
- ascending:YES];
- NSArray *sortDescriptors = [NSArray arrayWithObject:sortDescriptor];
- NSArray *sortedArray = [drinkDetails sortedArrayUsingDescriptors:sortDescriptors];
- NSArray *sortedArray;
- sortedArray = [drinkDetails sortedArrayUsingComparator:^NSComparisonResult(id a, id b) {
- NSDate *first = [(Person*)a birthDate];
- NSDate *second = [(Person*)b birthDate];
- return [first compare:second];
- }];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement