Để đổi màu nền cell, gán cell.contentView.backgroundColor trong cellForRowAt:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! TableViewCell
cell.contentView.backgroundColor = UIColor.cyan
return cell
}
Khác với đổi màu nền cả TableView (dùng tableView.backgroundColor).