I have an array of dictionaries where dictionary is like this.
Rows = (
"<DriverRowRecord: 0x7f8de3a240d0>",
"<DriverRowRecord: 0x7f8de3a18790>"
);
Sections = "<DriverSectionRecord: 0x7f8de3a2c5a0>";
Here DriverRowRecord
and DriverSectionRecord
are separate classes. In DriverSectionRecord
I have a date
property.
@interface DriverSectionRecord : NSObject
@property(nonatomic,retain)NSDate *date;
@end
Now I want to sort the array based on DriverSectionRecord
's date
property. If the dictionary contains the date
key I sort it like this.
NSSortDescriptor *descriptor = [[NSSortDescriptor alloc] initWithKey:@"date" ascending:YES];
NSArray *descriptors = [NSArray arrayWithObject:descriptor];
NSArray *Ascendingorder = [Array sortedArrayUsingDescriptors:descriptors];
However, it doesn't work as date
is a property of DriverSectionRecord
. How can I achieve this?