Last Updated: September 09, 2019
·
6.57K
· joseph_carney

Working with #HEX colours in xCode

Set up a #define and define each hex colour...

#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]

#define COLOR_ORANGE        0xFB9700

Insert it where you would normally use an UIColor...

[label setTextColor:UIColorFromRGB(COLOR_ORANGE)];

1 Response
Add your response

Thanks

over 1 year ago ·