I have a large array of data which I am displaying in a UITable. The table is broken into sections alphabetically. When a user selects a cell, I need to figure out where in the array that item is. The only identifying data in the cell is the label, which doesn't seem to be any help. The data in the array is not necessarily ordered alphabetically either. How can I figure out which item in the array they selected. Can I tie metadata or something to the table cell? I thought to make some kind of calculation based on the indexPath and the total count in the array, but since the array is not alphabetical, and the table is, this won't work.
Hope this makes sense. Thanks for any help.
It's typically a problem that solves itself. When you build the datasource for the tableview you have to sort your array in a way that makes sense for you to be able to display the information consistently, this is also going to lead to you being able to access it consistently.
In other words you're accessing something to build the table for your datasource calls of -tableView:cellforrowatindexpath:, the algorithm you use to build the cell will be the same you'll use to access the selected cell using the index path with didSelectCellAtIndexPath:.