Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added colorFromHex to uicolor categories

  • Loading branch information...
commit 3dfa750400aa5c35a7d67b5c7a63ba61e2718847 1 parent d3f5c02
@MugunthKumar authored
View
2  SSToolkit/UIColor+SSToolkitAdditions.h
@@ -9,5 +9,5 @@
@interface UIColor (SSToolkitAdditions)
- (CGFloat)alpha;
-- (UIColor) colorFromHex:(int) hexColor; // Mugunth Kumar
+- (UIColor*) colorFromHex:(int) hexColor; // Mugunth Kumar
@end
View
14 SSToolkit/UIColor+SSToolkitAdditions.m
@@ -14,17 +14,13 @@ - (CGFloat)alpha {
return CGColorGetAlpha(self.CGColor);
}
-- (UIColor) colorFromHex:(int) hexColor
+- (UIColor*) colorFromHex:(int) hexColor
{
-
- float redComponent = (float)((hexColor & 0xFF0000) >> 16))/255.0;
- float greenComponent = (float)((hexColor & 0x00FF00) >> 8))/255.0;
- float blueComponent = (float)(hexColor & 0x0000FF)/255.0;
+ float redComponent = (float)(((hexColor & 0xFF0000) >> 16)/255.0);
+ float greenComponent = (float)(((hexColor & 0x00FF00) >> 8)/255.0);
+ float blueComponent = (float)((hexColor & 0x0000FF)/255.0);
- return [UIColor colorWithRed:redComponent
- green:greenComponent
- blue:blueComponent
- alpha:1.0]
+ return [UIColor colorWithRed:redComponent green:greenComponent blue:blueComponent alpha:1.0];
}
@end
Please sign in to comment.
Something went wrong with that request. Please try again.