I made a little program calculating gas consumption. There is one view controller for each data entry necessary to calculate consumption in the final view controller. So you enter the driven distance in the first controller, the gas fuelled up in the next controller. in the controller displaying the result, the current date is added, too. All entries are stored in a plist file as strings for easier use with the tableviews later (except for the date).
Now I want to open this data in a summary view controller to populate a tableview.
Currently I have retrieve 3 arrays from the plist file (similar to the columns of a table): array 1: NSDate array 2: NSString representing a number array 3: NSString representing a number
I know how to populate my tableview, but I cannot wrap my head around the sorting. I tried changing the column approach into a table row based approach getting every single element from each of the arrays and adding them to a new array, containg each a date and two numbers (as strings).
I tried setting up sortdescriptors, I tried using selectors, but it seems I don't fully comprehend how to work it. Personally, I prefer examples, so I was looking for tutorials on this topic. The developer documentary didn't help that much.
I don't expect to get a complete example for this problem, but maybe some pointers on how to arrange my data and what best to use to sort the complete data array.
Thanks for any pointers or examples.
EDIT: I finally got all "Table-lines" as "rows" into a dictionary. Now I can access the single columns by key for the column. And this also allows sorting the stringvalues in my array of dictionaries ascending or descending using a sortdescriptor.
This may not be the most elegant approach, but I think I now can do what I wanted. Excuse the "Table" comparisons, but I find this easier to grasp.
If anyone has pointers to good array tutorials, I'd be more than thankful.