Created
August 14, 2011 14:35
-
-
Save 0xc010d/1144925 to your computer and use it in GitHub Desktop.
This file contains 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+Defined.h | |
typedef uint32_t DColor; | |
+ (UIColor *)colorWithDefinedColor:(DColor)dColor; | |
+ (UIColor *)colorWithDefinedColor:(DColor)dColor alpha:(CGFloat)alpha; | |
//UIColor+Defined.m | |
+ (UIColor *)colorWithDefinedColor:(DColor)dColor { | |
return [self colorWithDefinedColor:dColor alpha:1.0f]; | |
} | |
+ (UIColor *)colorWithDefinedColor:(DColor)dColor alpha:(CGFloat)alpha { | |
CGFloat blue = (dColor & 0xff) / 255.0f; | |
CGFloat green = (dColor >> 8 & 0xff) / 255.0f; | |
CGFloat red = (dColor >> 16 & 0xff) / 255.0f; | |
return [self colorWithRed:red green:green blue:blue alpha:alpha]; | |
} | |
//Constants.h | |
#import "UIColor+Defined.h" | |
extern DColor const myColor; | |
//Constants.m | |
DColor const myColor = 0xcccccc; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment