My Situation:
I have an NSDictionary object. Keyed by NSNumber. Values are custom objects.
I want to put dictionary values into a UITableView. As far as I can tell, UITableView requires that its source collection be indexed so when cellForRowAtIndexPath is called, you can use the indexPath to look up the value.
Problem is that when didSelectRowAtIndexPath is called, I want to look up the object from the dictionary, but I don't have the key. All I have is the indexPath.row.
My solution: I create an array of keys. I use the index of the array to get the key, and then use the key to get the object out of the dictionary.
My problem: This seems kind of sloppy especially since this is a routine task (populating the UITableView and then responding when someone touches a cell). Is this the way it's designed to work or is there a better way?