我有很多tableview
行,大约 60 行,我希望用户能够check
或他想要的行数。问题是当我检查某个时,该位置的所有其他单元格也会被检查。例如,如果我检查第 5 行,第 15、25、35 等行也会得到 a ,我不希望这种情况发生。我需要检查的行只是用户真正选择的行。这是我的方法代码uncheck
UITableViewCellAccessoryCheckmark
cell
UITableViewCellAccessoryCheckmark
didSelectRowAtIndexPath
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
Materia *current = [Manejador MateriasEnListaAtIndex:indexPath.row ];
if(cell.accessoryType == UITableViewCellAccessoryCheckmark){
cell.accessoryType = UITableViewCellAccessoryNone;
[ManejadorVistas EliminarMateria:current];
}
else{
cell.accessoryType = UITableViewCellAccessoryCheckmark;
[ManejadorVistas AgregarMateria:current];
}
}