RBG on iOS the correct way
#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]
Normal people think in hex color codes (so does photoshop) this helpful macro will make your life easy. Use it like this with the full hex color code and no quotes or anything:
segmentedControl.tintColor = UIColorFromRGB(0x56be8c);
Written by esromneb
Related protips
1 Response
I also captured this in a RGBX and RGBXA macro as part of MNColorKit available as a CocoaPod at https://github.com/madninja/MNColorKit in case it's of use to anyone
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Macro
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#