I have encountered a really puzzling bug. The first row of my UITableView returns 1 and the second one returns 0 in the indexPath! How is t
Despite the title, the overloaded method is in fact didDeselectRowAtIndexPath
, so it sounds like the behaviour is correct -- when the 1th row is touched, the 0th becomes deselected, and vice versa.
You have implemented didDeselectRowAtIndexPath. It will be fired when the row is no longer selected.
When you touch the second row, the first row is no longer selected, so [0, 1] will be shown.
When you touch the first row again, the second row is now no longer selected, so [0, 0] will be shown.
These are totally expected.
Implement didSelectRowAtIndexPath if you need it to respond when the row is selected.
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// ^
...
NSLog(@"IndexPath: %@", [indexPath description]);
}