UIColor colorWithRed:green:blue:alpha: always returns white unless one argument is 0

后端 未结 4 1146
轻奢々
轻奢々 2020-12-03 23:23

I am using

[UIColor colorWithRed:136 green:155 blue:218 alpha:1.0]; 

to change the background color of my table view cells.

But fo

4条回答
  •  孤城傲影
    2020-12-03 23:39

    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]; 
    

提交回复
热议问题