views:

20

answers:

1
const CGFloat *color = CGColorGetComponents([[UIColor whiteColor] CGColor]);
CGContextSetFillColor(context, color);

I have black background. While working this above code not sure whats wrong most of the colors work like redColor, purpleColor, greenColor, yellowColor
but whiteColor, grayColor does not work. when i use whiteColor screen looks empty.

+1  A: 

whiteColor and greyColor have colorspace different from redColor, purpleColor etc (I guess gray and rgb correspondently) and CGContextSetFillColor requires that appropriate color space is set (using CGContextSetFillColorSpace). Note also that docs say that prefered method to set fill color is CGContextSetFillColorWithColor function.

Vladimir
Using CGContextSetFillColorWithColor solved the problem
coure06