UIColor colorWithRed:green:blue:alpha:除非一个参数为0,否则总是返回白色 [英] UIColor colorWithRed:green:blue:alpha: always returns white unless one argument is 0
本文介绍了UIColor colorWithRed:green:blue:alpha:除非一个参数为0,否则总是返回白色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用
[UIColor colorWithRed:136 green:155 blue:218 alpha:1.0];
可更改表格视图单元格的背景颜色。
to change the background color of my table view cells.
但是由于某种原因,背景只是保持白色。如果我尝试
But for some reason the background just stays white. If I try
[UIColor colorWithRed:0 green:155 blue:218 alpha:1.0];
颜色变化。这对我来说没有意义。任何建议或提示?
the color changes. This does not make sense to me. Any advice or tips?
推荐答案
参数不是0到255的值,而是介于0.0和1.0之间的浮点数: / p>
The parameter aren't a values of 0 to 255 but a float between 0.0 and 1.0:
[UIColor colorWithRed:0.0f/255.0f green:155.0f/255.0f blue:218.0f/255.0f alpha:1.0f];
这篇关于UIColor colorWithRed:green:blue:alpha:除非一个参数为0,否则总是返回白色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文