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 35 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
- 9,044
- 5
- 30
- 41