0

UITableView我正在创建一个列表应用程序,用户可以在其中检查项目,在短暂延迟后检查时,选中的项目移动到底部( 中的不同部分)。用户可以通过点击它来“取消选中”该项目,然后它会移回原始部分。

我的问题是,当单元格在这样的部分之间移动时,似乎UITableView会“混淆”哪些单元格在哪里。

当我NSLog与之IndexPath.row交互的单元格返回与我触摸不同的行时。我用来[self.tableView moveRowAtIndexPath:from_indexPath toIndexPath:to_indexPath];在部分之间移动单元格。这是我的一些代码:

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{

switch (indexPath.section) {
    case SECTION_ACTIVE:{
        ItemData *dataForCell = [activeList objectAtIndex:indexPath.row];

       NSLog(@"%@ \t %d",dataForCell.title, indexPath.row);
        if (dataForCell.isHeader) {
           NSLog(@"%d",indexPath.row);
            return 70;
        }
        break;
    }
    default:
        break;
}

return 55;
}

有没有办法解决这个问题?或者解决这个问题?

4

1 回答 1

1

You can tag your table cells and can re-check it when you move your cell from one section to another.

于 2013-01-24T14:43:01.920 回答