Accessorytype 取消所有选择

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

猜你喜欢

转载自wang-peng1.iteye.com/blog/1867868