-(void)uncheckCells
{
for (int section = 0, sectionCount = self.tableView.numberOfSections; section < sectionCount; ++section) {
for (int row = 0, rowCount = [self.tableView numberOfRowsInSection:section]; row < rowCount; ++row) {
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:row inSection:section]];
cell.accessoryType = UITableViewCellAccessoryNone;
cell.accessoryView = nil;
}
}
}
有可能 还需要 [self.tableView reloadData];
取消UITableViewCell选中状态
本文介绍了一种在UITableView中批量取消所有单元格选中状态的方法。通过遍历表格的每一个部分和每一行,将UITableViewCell的accessoryType设置为UITableViewCellAccessoryNone,并移除accessoryView,实现了清除所有单元格的选中标志。
8

被折叠的 条评论
为什么被折叠?



