Object-C Style

CGFloat red, green, blue, alpha;

red = 1.0f;

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


//or

CGContextSetStrokeColorWithColor(UIGraphicsGetCurrentContext(), [[UIColor redColor] CGColor]);


Swift Style

let myUIColor = UIColor.purpleColor()

var r:CGFloat, g:CGFloat, b:CGFloat, a:CGFloat = 0

myUIColor.getRed(&r, green: &g, blue: &b, alpha: &a)

CGContextSetRGBStrokeColor(c, r, g, b, a)


// or

CGContextSetStrokeColorWithColor(myUIColor.CGColor);



WRITTEN BY
블로blow
iOS 개발자 생활이야기

트랙백  0 , 댓글  0개가 달렸습니다.
secret