UItableviewCell的背景颜色不起作用

时间:2014-06-23 15:09:27

标签: ios uitableview uibackgroundcolor

我正在设置我的uitableviewCell的背景颜色,如

 cell.contentView.backgroundColor = [UIColor colorWithRed:8.0 green:210.0 blue:11.0 alpha:1.0];
然而,如果我喜欢

,它就无法正常工作
 cell.contentView.backgroundColor = [UIColor grayColor];

然后它起作用。任何帮助

1 个答案:

答案 0 :(得分:1)

UIColor必须定义为介于0和1之间才能使 RGB 值生效(UIColor class reference):

cell.contentView.backgroundColor = [UIColor colorWithRed:8.0f/255.0f green:210.0f/255.0f blue:11.0f/255.0f alpha:1.0f];
相关问题