实现UITableView时,我添加了背景图像并将表视图设置为透明。但是,即使将表视图单元格更改为不同的颜色(以便更好地查看文本),表格的边仍保持清晰,如此图中所示:Table View Cell。iOS:在更改单元格背景时,UITableViewCell的边显示不同的颜色(Xcode 8,Swift 3)
我相加得到表视图的内部代码:
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
cell.backgroundColor = UIColor(white: 1, alpha: 0.25)
cell.accessoryView?.backgroundColor = UIColor(white: 1, alpha: 0.25)
cell.contentView.backgroundColor = UIColor(white: 1, alpha: 0.25)
cell.tintColor = UIColor(white: 1, alpha: 0.25)
}
而且在viewWillAppear
:
self.tableView.backgroundColor = UIColor(white: 1, alpha: 0.25)
我不知道为什么两边都不显示为相同的颜色。我认为这与配件按钮有关,但当试图改变这一点时,没有任何改变。
我知道这一点。问题不在于颜色本身,而在于单元格的alpha。 alpha因子不适用于双方。 –
它的确如此,你知道的。但正如我所说,在某些地区,你将一个字母与另一个字母叠加。 – matt