我正在使用具有多个部分的分组表视图。而且我必须在 indexpath 方法的 didselectrow 上实现多项选择的功能。我的代码如下。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)path
{
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:path];
    if (cell.accessoryType == UITableViewCellAccessoryCheckmark)
    {
        cell.accessoryType = UITableViewCellAccessoryNone;
    }
    else
    {
        cell.accessoryType = UITableViewCellAccessoryCheckmark;
    }
} 
这允许我选择多个单元格,但是当我滚动我的表格视图时,我的选择消失了。