Created
January 7, 2012 21:56
-
-
Save codeswimmer/1576181 to your computer and use it in GitHub Desktop.
iOS: Drawing a path in a custom UIView
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* 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