views:

71

answers:

1

Check out the code

const CGFloat *c = CGColorGetComponents([[UIColor whiteColor] CGColor]); 
slider1.value = c[0];
slider2.value = c[1];
slider3.value = c[2];

c[2] is getting 0. For whiteColor all RGB values shld be 1.0. Why its not returning correct value for the blue component?

Any code snippet? for getting RGB values from white color?

+5  A: 

Try CGColorGetColorSpace([[UIColor whiteColor] CGColor])

You will see it is not RGB. It has 2 components only: greyscale and alpha

mustISignUp
how to get RGB values then?
coure06
The color space used for white is grayscale (1 component and alpha). To get RGB values from grayscale color, you have to use the grayscale value for R, G and B.
Laurent Etiemble
Can you please give some code?
coure06
slider1.value = c[0]; slider2.value = c[0]; slider3.value = c[0];
mustISignUp