Created
November 6, 2013 03:46
-
-
Save bugcloud/7330542 to your computer and use it in GitHub Desktop.
UIColor from HEX format string
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
| NSString *stringColor = @"#AABBCC"; | |
| NSUInteger red, green, blue; | |
| sscanf([stringColor UTF8String], "#%02X%02X%02X", &red, &green, &blue); | |
| UIColor *color = [UIColor colorWithRed:red/255.0 green:green/255.0 blue:blue/255.0 alpha:1]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment