我已经尝试了一切来让它工作,但是当我滚动时cellForRowAtIndexPath
,它似乎在我的 tableview 上添加和删除复选标记,有人可以帮忙吗?
// Configure the cell...
cell.textLabel.text = [currencyList objectAtIndex:indexPath.row];
// Check to see what currency is currently selected and checkstyle
if ([selectedCurrency isEqualToString:cell.textLabel.text]) {
// Add a tick to the selected row
cell.accessoryType = UITableViewCellAccessoryCheckmark;
// Change the text colour
cell.textLabel.textColor = [UIColor colorWithRed:0 green:0 blue:0.5 alpha:1];
self.checkedIndexPath = indexPath;
} else {
UITableViewCell *uncheckCell = [self.tableView
cellForRowAtIndexPath:self.checkedIndexPath];
uncheckCell.accessoryType = UITableViewCellAccessoryNone;
// Change the font colour back to black
uncheckCell.textLabel.textColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:1];
}