Created
January 17, 2011 20:06
-
-
Save leah/783376 to your computer and use it in GitHub Desktop.
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+HexColor.h | |
// | |
// Created by Leah Culver on 11/9/10. | |
// | |
#import <UIKit/UIKit.h> | |
@interface UIColor (HexColor) | |
+ (UIColor *)hexColor:(int)hexString; | |
@end |
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+HexColor.m | |
// | |
// Created by Leah Culver on 11/9/10. | |
// | |
#import "UIColor+HexColor.h" | |
@implementation UIColor (HexColor) | |
+ (UIColor *)hexColor:(int)hex { | |
float red = ((float)((hex & 0xFF0000) >> 16))/255.0; | |
float green = ((float)((hex & 0xFF00) >> 8))/255.0; | |
float blue = ((float)(hex & 0xFF))/255.0; | |
return [UIColor colorWithRed:red green:green blue:blue alpha:1.0]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment