xcode 如何为我的 UITableView 单元格设置浅蓝色背景色?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6363032/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can i set a light blue back ground color to my UITableView cell?
提问by Christina
Possible Duplicate:
How can I set a cell on the iPhone as a custom color?
i need to set a light orange back ground color to my UITableView cell.so please any one help me to do it.i used the following code to get green color.so please help me to do it.
我需要为我的 UITableView 单元格设置浅橙色背景颜色。所以请任何人帮助我做到这一点。我使用以下代码获得绿色。所以请帮助我做到这一点。
need UIColor *myColor = "light orange color" also if you can UIColor *myColor = "light blue color"
需要 UIColor *myColor = " light orange color" 如果你可以的话 UIColor *myColor = " light blue color"
回答by Dancreek
You need RGB color values.
您需要 RGB 颜色值。
Then: UIColor *myColor = [UIColor colorWithRed: 180.0/255.0 green: 238.0/255.0 blue:180.0/255.0 alpha: 1.0];
然后: UIColor *myColor = [UIColor colorWithRed: 180.0/255.0 green: 238.0/255.0 blue:180.0/255.0 alpha: 1.0];
Keep in mind that the values you enter for red green and blue are based on a max value of 1.0. Normal RGB numbers are based on a max of 255 so you need to divide regular values by 255 to get the right values.
请记住,您为红绿蓝输入的值基于最大值 1.0。正常的 RGB 数字基于 255 的最大值,因此您需要将常规值除以 255 以获得正确的值。
回答by Nathan
Why not set your color to "clear" and use Photoshop (or some other editor" to make the color and style that you want?
为什么不将您的颜色设置为“清除”并使用 Photoshop(或其他一些编辑器)来制作您想要的颜色和样式?
[[cell textLabel] setBackgroundColor:[UIColor clearColor]];