I have a table view that's filled with custom cells. I can populate the table just fine and even zebra stripe the table (using indexPath.row % 2). However, when I click on any of the cells, the app crashes. Here's my didSelectRowAtIndexPath code in my table view controller:
Code:
- (void) tableView: (UITableView *) tableView
didSelectRowAtIndexPath: (NSIndexPath *) indexPath
{
NSLog(@"row clicked: %@", indexPath.row);
}
All I'm trying to do is spit out the row that was clicked. If row 0 is clicked, indexPath.row gives me "null". Any other visible row results in an EXC_BAD_ACCESS error. Any ideas why the indexPath gets hosed between creating the cell and clicking the cell?
Added:
Once I figure out which cell was clicked, I want to push a view controller. Each cell will have different info so it's important that I figure out which row it was. I've also got a standard UITableView elsewhere in the app that doesn't have this problem. If I jump into the setSelected: animated function in my custom cell, I can also tell when the cell was clicked (and get it's ID) but an unsure of how to push the view controller from there as self.navigationController isn't defined in a UITableViewCell. Which is the "better" way to push the view controller?