开发者

question related to UIColour

开发者 https://www.devze.com 2022-12-25 18:00 出处:网络
I have RGB for setting colour of my label it is like this R-:0 G:-78 B-255 开发者_运维知识库and hash code is #004eff

I have RGB for setting colour of my label

it is like this R-:0 G:-78 B-255 开发者_运维知识库and hash code is #004eff

can u tell me how to give this to my label as under below

UILabel *label;


UIColor takes RGB values as a float between 0.0 and 1.0. To get that from a value between 0 and 255, you need to divide by 255.

[myLabel setTextColor:[UIColor colorWithRed:0/255.0 green:78/255.0 blue:255/255.0 alpha:1.0]];

You may want to write a category method that does this for you, or even a simple preprocessor macro.

0

精彩评论

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