How to get value (float) for RG & B of UIColor object?

I created a UIColor object and want to set the colors before painting using CGContextSetRGBStrokeColor. To do this, I need to extract the values ​​from red, green and blue from the UIColor object. How should I do it?

Or maybe the best way to determine the color using some other methods (could not find when I was looking for it) in which I can use the UIColor object to set the color?

Thanks in advance!

/ Niklas

+3
source share
2 answers

RGB . CGContextSetStrokeColorWithColor CGContextSetRGBStrokeColor.

CGContextSetStrokeColorWithColor(context, thatUIColor.CGColor);

( RGB, . RGB UIColor?.)

+11
0

Source: https://habr.com/ru/post/1755173/


All Articles