Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void)viewDidLoad {
- [super viewDidLoad];
- UIColor *cBlue = [UIColor blueColor];
- UIColor *cOrange = [UIColor orangeColor];
- UIColor *cRed = [UIColor redColor];
- [self listColorComponents:cBlue forMyName:@"Blue"];
- [self listColorComponents:cOrange forMyName:@"Orange"];
- [self listColorComponents:cRed forMyName:@"Red"];
- }
- - (void) listColorComponents:(UIColor *)theColor forMyName:(NSString *)theName {
- const CGFloat *cColors = CGColorGetComponents(theColor.CGColor);
- CGFloat r = cColors[0];
- CGFloat g = cColors[1];
- CGFloat b = cColors[2];
- CGFloat a = cColors[3];
- NSLog(@"%@ Red is %f / %d", theName, r, (int)(r * 255));
- NSLog(@"%@ Blue is %f / %d", theName, g, (int)(g * 255));
- NSLog(@"%@ Green is %f / %d", theName, b, (int)(b * 255));
- NSLog(@"%@ Alpha is %f / %d", theName, a, (int)(a * 255));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement