문제

I'm creating a drawing app and I would like to integrate NKO-Colour-Picker but the problem is I would like to use the UIColor from the picker as the stroke colour when a user draws on my UIView.

How would I do this as CGContextSetRGBStrokeColor is coded in RGB values not UIColor?

I currently have this:

CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), red, green, blue, 1);

Any help would be appreciated.

도움이 되었습니까?

해결책

Use:

UIColor *color = ... // your selected color
CGContextSetStrokeColorWithColor(UIGraphicsGetCurrentContext(), color.CGColor);

or simply do:

[color set];

or:

[color setStroke];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top