Sorting Objects in NSArray
- by Sam Budda
I have an NSArray with 3 objects in it. Each object is made up of 5 values. How can I sort by Date with in the objects?
result: (
gg,
"2012-10-28 01:34:00 +0000",
"Church Bells",
"pin_red",
1
)(
iu,
"2008-09-22 17:32:00 +0000",
"Birthday Song",
"pin_red",
1
)(
"my birthday woo hoo",
"2012-09-04 19:27:00 +0000",
"Birthday Song",
"pin_blue",
1
)
The results I am looking for - Sorted Array should look like this.
(
iu,
"2008-09-22 17:32:00 +0000",
"Birthday Song",
"pin_red",
1
)
(
"my birthday woo hoo",
"2012-09-04 19:27:00 +0000",
"Birthday Song",
"pin_blue",
1
)
(
gg,
"2012-10-28 01:34:00 +0000",
"Church Bells",
"pin_red",
1
)
I am getting this array from my nsdictionary object.
dictionary = [[NSMutableDictionary alloc] initWithContentsOfFile:stringsPlistPath];
stringsMutableArray = [[NSMutableArray alloc] initWithObjects:nil];
for (id key in dictionary)
{
[stringsMutableArray addObject:[dictionary objectForKey:key]];
}