Created
January 20, 2015 06:30
-
-
Save Ashton-W/5a6732de57004e08e959 to your computer and use it in GitHub Desktop.
nice inline function for hex to UIColor
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
NS_INLINE UIColor *UIColorFromHex(int hex) | |
{ | |
return [UIColor colorWithRed:((CGFloat)((hex & 0xFF0000) >> 16)) / 255.0f | |
green:((CGFloat)((hex & 0x00FF00) >> 8)) / 255.0f | |
blue:((CGFloat)((hex & 0x0000FF) >> 0)) / 255.0f | |
alpha:1.0]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment