I have created a UIColor object and want to set the colors before drawing using CGContextSetRGBStrokeColor. In order to do that I need to extract the values of red, green and blue from the UIColor object. How do I do that?
Or is there perhaps a better way defining the color using some other kind of methods (couldn't find when I looked for it though) in which I can use the UIColor object to set the color?
Thanks in advance!
/Niklas
You don't need the RGB components in your case. Just use CGContextSetStrokeColorWithColor instead of CGContextSetRGBStrokeColor.
CGContextSetStrokeColorWithColor(context, thatUIColor.CGColor);
(To get the RGB components, see How to get RGB values from UIColor?.)