I\'m creating a color object using the following code.
curView.backgroundColor = [[UIColor alloc] initWithHue:229 saturation:40 brightness:75 alpha:1];
UIColor *color = [[UIColor greenColor] retain]; //line 1
//OR(You will have color variable either like line 1 or line 2)
color = curView.backgroundColor;//line 2
CGColorRef colorRef = [color CGColor];
int _countComponents = CGColorGetNumberOfComponents(colorRef);
if (_countComponents == 4) {
const CGFloat *_components = CGColorGetComponents(colorRef);
CGFloat red = _components[0];
CGFloat green = _components[1];
CGFloat blue = _components[2];
CGFloat alpha = _components[3];
NSLog(@"%f,%f,%f,%f",red,green,blue,alpha);
}
[color release];