我想将我的 customTableViewCell 的背景设置为黑色。经过一番搜索后,最常见的答案是在我的 CellForRowAtIndex 中执行此操作。
cell.contentView.backgroundColor = [UIColor clearColor];
cell.backgroundColor = [UIColor blackColor];
但这并没有帮助。谁能帮帮我?
提前致谢!
最佳答案
按如下操作,并记住一件事,您在 contentview 上添加的任何 subview 都应该具有clearcolor。在我的例子中,我有默认的 textLabel,所以我将其设置为clear color。
cell.textLabel.backgroundColor = [UIColor clearColor];
cell.contentView.backgroundColor = [UIColor blackColor];
关于objective-c - 设置自定义 tableviewCell 的背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12838870/