Created
March 1, 2012 09:27
-
-
Save Joony/1948537 to your computer and use it in GitHub Desktop.
On Objective-C Macro for converting Hex values (or any number) to a UIColor object.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define UIColorFromRGBA(rgbaValue) [UIColor colorWithRed:((float)((rgbaValue & 0xFF0000) >> 16)) / 255.0 \ | |
green:((float)((rgbaValue & 0xFF00) >> 8)) / 255.0 \ | |
blue:((float)(rgbaValue & 0xFF)) / 255.0 \ | |
alpha:((float)((rgbaValue & 0xFF000000) >> 24)) / 255.0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIColor *color = UIColorFromRGBA(0xFFFFFFFF); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment