从自定义uitableviewcell推送segue需要两次点击并且无法正常工作

时间:2014-06-25 20:51:52

标签: ios iphone objective-c uitableview

我有自定义uitableviewcells的uitableview。试图从每个细胞中执行一个segue,会发生一些奇怪的事情。

我已经用NSLog跟踪代码,知道什么是happing(显示每个单元格的文本名称),如果我点击单元格,则不显示日志,如果我在其他单元格中单击,则日志显示以前单元格单击文本名称。

请注意,我有许多以编程方式创建的部分。所以我有很多阵列,每个部分一个。 uitableview是一个容器。

- (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;
    }



}

1 个答案:

答案 0 :(得分:1)

问题是您使用 didDeselectRowAtIndexPath 。你应该使用 didSelectRowAtIndexPath