Last active
August 27, 2015 13:17
-
-
Save acalism/254acd16e0f41ea36c78 to your computer and use it in GitHub Desktop.
This file contains 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
// You'll also need the QuartzCore framework added to the project | |
#import <QuartzCore/QuartzCore.h> | |
int x = 0; int y = 0; | |
int toX = 30; int toY = 40; | |
CGMutablePathRef linePath = CGPathCreateMutable(); | |
CGPathMoveToPoint(linePath, NULL, x, y); | |
CGPathAddLineToPoint(linePath, NULL, toX, toY); | |
CAShapeLayer *lineShape = [CAShapeLayer layer]; | |
lineShape.lineWidth = 4.0f; | |
lineShape.lineCap = kCALineCapRound;; | |
lineShape.strokeColor = [[UIColor blackColor] CGColor]; | |
lineShape.path = linePath; | |
CGPathRelease(linePath); | |
[self.layer addSublayer:lineShape]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment