如何在iPhone上将单元格设置为自定义颜色? [英] How can I set a cell on the iPhone as a custom color?
本文介绍了如何在iPhone上将单元格设置为自定义颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试像在HTML中一样添加自定义颜色:
I am trying to add custom color like how we do in HTML:
<body bgcolor=#ffffff> </body>.
我们可以在iPhone的单元格中显示类似的自定义颜色组合吗?
Can we have a similar kind of custom color combination for showing in cells on iPhones?
cell.backgroundColor = [ UIColor whiteColor]; but instead of whiteColor wanna use #ffffff.
我该如何实现?
推荐答案
Use UIColor colorWithRed:green:blue:alpha:. Colors are 0.0 to 1.0, something like this for bright red:
cell.backgroundColor = [UIColor colorWithRed:1.0f green:0 blue:0 alpha1];
对于诸如"808182"的颜色,它将是:
For a color such as "808182" it would be:
[UIColor colorWithRed:128/255.0f green:129/255.0f blue:130/255.0f alpha:1];
这篇关于如何在iPhone上将单元格设置为自定义颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文