Background - I'm trying to make my controller deselect a row when its selected and tapped
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
if ([cell isSelected]) {
// Deselect manually.
[tableView.delegate tableView:tableView willDeselectRowAtIndexPath:indexPath];
[tableView deselectRowAtIndexPath:indexPath animated:NO];
[tableView.delegate tableView:tableView didDeselectRowAtIndexPath:indexPath];
self.selectedRow = -1;
[tableView beginUpdates];
[tableView setTableHeaderView:self.headerView];
[tableView endUpdates];
} else {
self.selectedRow = indexPath.row;
[tableView beginUpdates];
[tableView setTableHeaderView:nil];
[tableView endUpdates];
}
return indexPath;
}
- (NSIndexPath *)tableView:(UITableView *)tableView willDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
return [super tableView:tableView willDeselectRowAtIndexPath:indexPath];
}
When the code executes and a row is tapped while selected:
tableView:willDeselectRowAtIndexPath:]: unrecognized selector sent to instance 0xbf59e00
My Controller inherits from UITableViewController. Its set as the delegate on the tableView. What am I missing?