Skip to content

Instantly share code, notes, and snippets.

@zengyun-hacker
Created October 7, 2013 03:32
Show Gist options
  • Save zengyun-hacker/6862167 to your computer and use it in GitHub Desktop.
Save zengyun-hacker/6862167 to your computer and use it in GitHub Desktop.
draw line
- (void)drawRect:(CGRect)rect {
[super drawRect:rect];
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetStrokeColorWithColor(context, [UIColor redColor].CGColor);
// Draw them with a 2.0 stroke width so they are a bit more visible.
CGContextSetLineWidth(context, 2.0);
CGContextMoveToPoint(context, 0,0); //start at this point
CGContextAddLineToPoint(context, 20, 20); //draw to this point
// and now draw the Path!
CGContextStrokePath(context);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment