UITableViewCell

1.设置背景

 cell.backgroundColor = D_cellColor2;             //错误做法
 cell.contentView.backgroundColor = D_cellColor2; //正确做法        

2. 重用单元格注意问题

 GoodsListTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reusableCellIdentifier];
    if (cell == nil) {
        NSArray *nibArr = [[NSBundle mainBundle] loadNibNamed:@"GoodsListTableViewCell" owner:self options:nil];
        cell = (GoodsListTableViewCell *)[nibArr objectAtIndex:0];
        cell.selectionStyle = UITableViewCellSelectionStyleBlue;
    }
    //视图可以重用,但是数据还是要重新定义
    cell.goodsInfoVo = [_goodsInfoArray objectAtIndex:indexPath.row];
原文地址:https://www.cnblogs.com/apem/p/4155422.html