我正在更改自定义 tableView 按钮颜色上的单元格颜色。单元格 indexRow 在按钮单击时变为绿色,但在滚动后再次变为正常的白色。我尝试了不同的解决方案,但没有结果。你能建议一下吗?谢谢。
-(void)yesAction:(id)sender
{
_cellButtonPress = YES;
// [myChklist reloadData];
UIButton *button = (UIButton *)sender;
UITableViewCell *cell = (UITableViewCell *)button.superview.superview;
UITableView *curTableView = (UITableView *)cell.superview;
NSIndexPath *indexPath = [curTableView indexPathForCell:cell];
cell.backgroundColor = [UIColor greenColor];
}