简体   繁体   中英

How to set the colour to Cayenne programmatically

Just a quick question...

In interface builder, you have several colours that you can assign to objects.

I would like to set the headers of my tableview to the Cayenne colour but how can I call this colour programmatically ?

Any idea ?

Thanks,

Mike

Actually, I have found a way to do it by using Digital Color Meter which is a too you can find in the Utilities Folder in your Application Folder on MacOsx.

You pick the color with the tool, that gives you an RGB value and then you divide the numbers by 100. For the Cayenne, color, the tool values were 49.8 0 0, and so the equivalent is :

[UIColor colorWithRed:.498 green:0 blue:.0 alpha:1]

Hope it will help others.

Miky Mike

What MikyMike had is close, but you need to divide by 255, not by 100. The accepted answer in Using [UIColor colorWithRed:green:blue:alpha:] doesn't work with UITableView seperatorColor? shows a good way to do this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM