Skip to content

Instantly share code, notes, and snippets.

@rraallvv
Created April 9, 2015 21:31
Show Gist options
  • Save rraallvv/7e1e9e47ac31ed46bd84 to your computer and use it in GitHub Desktop.
Save rraallvv/7e1e9e47ac31ed46bd84 to your computer and use it in GitHub Desktop.
draw path with points in cocoa
CGPoint points[num];
CGContextRef ctx = [[NSGraphicsContext currentContext] graphicsPort];
CGMutablePathRef path = CGPathCreateMutable();
CGPathAddLines(path, NULL, points, num);
if (closePath) CGPathCloseSubpath(path);
CGContextAddPath(ctx,path);
CGContextStrokePath(ctx);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment