I have an editable pList with a dictionary of strings in the format:
21-10-2010 -> @"item1"
20-10-2010 -> @"item2"
19-10-2010 -> @"item3"
18-10-2010 -> @"item4"
17-10-2010 -> @"item5"
ect...
So with dates in stringformat as keys, and strings with different information as value. The lenght of the dictionary can become up to 200 keys. And the keys don't necessarily come in order, and there might be missing some dates.
I want to show the keys and their values in a tableview with UITableViewCellStyleValue2. At the moment I'm putting them in the tableview by writing all the keys to a global NSMutableAray at startup:
keysArray = [myDictionary allKeys];
and then in the tableview method, I'm putting them in by using normal indexPath as index to the array:
cell.textLabel.text = [keysArray objectAtIndex:indexPath];
cell.detailTextLabel.text = [myDictionary objectForKey: [keysArray objectAtIndex:indexPath]];
This is working, but the dates are not in order with the highest date first. This is because the 'allKeys'-function returns the keys in random order (also there arent order in the dictionary it self).
The whole method of cycling through a global array, and reffering this value as a key to another dictionary, that's loaded from a extern pList file, is really complicated and awkward. So I'm looking for either a way to sort an NSMutableArray by date, or a better way to implement what I want.
Thank you for listening, John.