我有一个 UITableView,我想以 3 种不同的背景颜色显示。基本上是白色、浅灰色、深灰色,然后再回到白色等等。
到目前为止,这是我在堆栈溢出中所能找到的全部内容:
if (indexPath.row % 2) {
cell.contentView.backgroundColor = [UIColor lightGrayColor];
} else {
cell.contentView.backgroundColor = [UIColor darkGrayColor];
}
这适用于 2 种颜色。如何在 3 种颜色之间交替?