我有一个带有表格视图的 iOS 应用程序。我遇到的一个问题是我无法使用自定义 RGB 颜色设置单元格背景颜色。
例如,这将起作用:
// Set the background colour.
[cell contentView].backgroundColor = [UIColor redColor];
然而,另一方面这将不起作用:
// Set the background colour.
[cell contentView].backgroundColor = [UIColor colorWithRed:(54/255.0) green:(215/255.0) blue:(183/255.0) alpha:1.0];
我不明白为什么只设置一种模糊的背景颜色就这么难!... :(
我对此感到非常沮丧,因为我尝试了很多不同的方法,包括:
- 将自定义添加
UIView
到我的单元格的背景并设置其背景颜色。 willDisplayCell
已尝试在方法中设置此属性。- 都试过了
cell.backgroundColor
,cell.contentView
都不管用。
不UITableView
支持自定义 RGB 颜色之类的吗?