My object "Event" has got a property NSDate
.
I fill a NSMutableArray
with "Event" objects.
Is there a way to order by NSDate
the members of my NSMutableArray
?
Thank you all.
Asked
Active
Viewed 33 times
1 Answers
1
Assuming you have an NSMutableArray
[yourArray sortUsingComparator:^NSComparisonResult(Event *obj1, Event *obj2){
return [obj1.date compare:obj2.date];
}];
Otherwise :
NSArray sortedArray = [yourArray sortedArrayUsingComparator:^NSComparisonResult(Event *obj1, Event *obj2) {
return [obj1.date compare:obj2.date];
}];
streem
- 8,835
- 5
- 28
- 40