Draw line

suggest change

Call this from drawRect: or after UIGraphicsBeginImageContext. UIGraphicsGetCurrentContext() is NULL otherwise, and the CGContext calls crash. The stroke uses the context’s current color.

CGContextRef context = UIGraphicsGetCurrentContext();

CGContextSetLineWidth(context, 5.0);
CGContextMoveToPoint(context, 200, 400);
CGContextAddLineToPoint(context, 100, 100);
CGContextStrokePath(context);

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents