All colors except whiteColor

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

I have a black background. When working on this code, I’m not sure that most colors, such as redColor, purpleColor, greenColor, yellowColor, do not work correctly
but whiteColor, grayColor is not working. when i use the whiteColor screen looks blank.

+1
source share
1 answer

whiteColor and greyColor have a different color space than redColor , purpleColor , etc. (I assume gray and rgb, respectively), and CGContextSetFillColor requires that the corresponding color space be set (using CGContextSetFillColorSpace). Also note that docs say the preferred method to set the fill color is the CGContextSetFillColorWithColor function.

+4
source

All Articles