有没有办法为每个其他单元格着色一种颜色tableView
?我试图查看我的属性,tableView
但找不到任何东西。
我想要这样:
tableview
cell - white
cell - gray
cell - white
cell - gray
等等...
最简单的方法是在您的cellForRowAt
函数中以编程方式执行此操作:
if indexPath.row % 2 == 0 {
cell.backgroundColor = UIColor.white
} else {
cell.backgroundColor = UIColor.gray
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句