Jose
Jose

Reputation: 1067

UITableView didDeselectRowAtIndexPath Cell returns on unselected Not on Selected

My table view returns the row on unSelect instead of onSelect, so when I select the first cell didDeselectRowAtIndexPath return nothing, but when I select other cell I get the unselecting cell row instead of the one select. Working backwards?

    - (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
    //NSLog(@"%i", indexPath.row);
    _myLabel.text = [myDataArray objectAtIndex:indexPath.row];
}

Upvotes: 0

Views: 738

Answers (2)

PunjabiCoder
PunjabiCoder

Reputation: 525

Use didSelectRowAtIndexPath method instead of didDeselectRowAtIndexPath.

Upvotes: 0

GenieWanted
GenieWanted

Reputation: 4513

You are doing it wrong. You are using didDeselectRowAtIndexPath instead of didSelectRowAtIndexPath method. If you want to select a particular row on tap, you will need to use didSelectRowAtIndexPath.

Upvotes: 3

Related Questions