quindimildev
quindimildev

Reputation: 1280

Push segue from custom uitableviewcell needs two clicks and does not work properly

I have a uitableview with custom uitableviewcells. Trying to perform a segue from each cell, something strange happens.

I have traced the code with an NSLog to know what is happing (showing each cell textname), and if I click over a cell, the log is not showed, and If I click in other cell after , the logs displays the previously cell clicked textname.

Note that I have many sections created programmatically. So I have many Arrays, one for each section. The uitableview is into a container.

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


    switch (indexPath.section) {
        case 0:
            NSLog(@"Cell: %@",[opcionesEstado objectAtIndex:indexPath.row]);
            break;
        case 1:
            NSLog(@"Cell: %@",[opcionesPersonajes objectAtIndex:indexPath.row]);
            break;
        case 2:
            NSLog(@"Cell: %@",[opcionesNoticias objectAtIndex:indexPath.row]);
            break;
        case 3:
            NSLog(@"Cell: %@",[opcionesAjustes objectAtIndex:indexPath.row]);
            break;
        case 4:
            NSLog(@"Cell: %@",[opcionesLogout objectAtIndex:indexPath.row]);
            break;
    }



}

Upvotes: 0

Views: 94

Answers (1)

Artem Stepanenko
Artem Stepanenko

Reputation: 3526

The problem is you use didDeselectRowAtIndexPath. And you should use didSelectRowAtIndexPath.

Upvotes: 1

Related Questions