Skip to content

Instantly share code, notes, and snippets.

@codeswimmer
Created January 7, 2012 21:56
Show Gist options
  • Select an option

  • Save codeswimmer/1576181 to your computer and use it in GitHub Desktop.

Select an option

Save codeswimmer/1576181 to your computer and use it in GitHub Desktop.
iOS: Drawing a path in a custom UIView
/* Drawing a path in a custom UIView
-(void)drawRect:(CGRect)rect
{
CGContextRect context = UIGraphicsGetCurrentContext();
CGContextBeginPath(context);
CGContextMoveToPoint(context, 75, 10);
CGContextAddLineToPoint(context, 160, 150);
CGContextAddLineToPoint(context, 10, 150);
CGContextClosePath(context);
[[UIColor blueColor] setFill];
[[UIColor whiteColor] setStroke];
CGContextDrawPath(context, kCGPathFillStroke);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment