开发者

Unable to use customized color in TableView separator

开发者 https://www.devze.com 2023-03-11 16:48 出处:网络
I have a tableView with more than one section in it. For applying a color on each section\'s outline I am using the following code in viewDidLoad:

I have a tableView with more than one section in it. For applying a color on each section's outline I am using the following code in viewDidLoad:

[tableView setSeparatorColor: [UIColor blueColor]];

Now, I need to apply a customized color in the s开发者_JAVA百科ection outline for which i am using:

[tableView setSeparatorColor: [UIColor colorWithRed: r green: g blue: b alpha:1]];

But it shows white color instead. I am unable to use this customized color. Plz help!

o_O


Please, be sure that the r, g and b variable are floats in the range [0,1]. Then everything should work fine.

Edit

To be able to use RGB values you should change your code this way:

[UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1]

so that you can set r, g and b in the [0,255] range.

0

精彩评论

暂无评论...
验证码 换一张
取 消