Skip to content

Instantly share code, notes, and snippets.

@0xMarK
Created January 28, 2014 23:03
Show Gist options
  • Save 0xMarK/8678511 to your computer and use it in GitHub Desktop.
Save 0xMarK/8678511 to your computer and use it in GitHub Desktop.
Adds a white bordered complex shape to a UIView.
UIBezierPath* bezierPath = [UIBezierPath bezierPath];
[bezierPath moveToPoint:CGPointMake(0.0, 5.0)];
[bezierPath addArcWithCenter:CGPointMake(5.0, 5.0) radius:5.0 startAngle:DEGREES_TO_RADIANS(180) endAngle:DEGREES_TO_RADIANS(-90) clockwise:YES];
[bezierPath addLineToPoint:CGPointMake(5.0, 20.0)];
[bezierPath closePath];
CAShapeLayer *shape = [CAShapeLayer layer];
shape.frame = self.poster.bounds;
shape.path = bezierPath.CGPath;
shape.fillColor = [UIColor clearColor].CGColor;
shape.lineWidth = 2;
shape.strokeColor = [UIColor whiteColor].CGColor;
[self.poster.layer addSublayer:shape];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment