UITableView didSelectRowAtIndexPath: not being called on first tap

Please, try to change your -viewDidLoad to the code below (insert last line). Tell me about the results.

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    [self.tableView reloadData];
}

I am not sure if this has been answered but I was running with this issue and just like "Anna Karenina" commented above. Make sure that you pay close attention to detail.

This is cause by you implementing the DEselect

-(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath

This will cause the first click not to work but following clicks and any other cell will work as expected.

Solution: make sure you pay attention and use didSelectRowAtIndexPath

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

hope that helps and like I mention before this was solved by "Anna Karenina"


You may have implemented (notice the Deselect): didDeselectRowAtIndexPath

...hence the trigger upon selecting a new cell which deselects the first one, and logging indexPath as the first one as well.

SOLUTION: didSelectRowAtIndexPath

yeah, they look super similar, and it doesn't help that didDeselectRowAtIndexPath is the first method Xcode's autocomplete selects most of the time.

FULL CODE:

// right
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {}