Skip to content

Instantly share code, notes, and snippets.

@iltercengiz
Last active December 16, 2016 05:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iltercengiz/173060f878c0373d0b9a to your computer and use it in GitHub Desktop.
Save iltercengiz/173060f878c0373d0b9a to your computer and use it in GitHub Desktop.
view.layer.cornerRadius = 8.0
imageView.layer.mask = starShape;
CAShapeLayer *maskLayer = [CAShapeLayer new];
maskLayer.frame = self.titleLabel.bounds;
maskLayer.path = maskPath.CGPath;
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.titleLabel.bounds
byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight
cornerRadii:CGSizeMake(8.0, 8.0)];
CAShapeLayer *starShape = [CAShapeLayer new];
starShape.frame = imageView.bounds;
starShape.path = starPath.CGPath;
UIBezierPath* starPath = UIBezierPath.bezierPath;
[starPath moveToPoint: CGPointMake(128, 0)];
[starPath addLineToPoint: CGPointMake(156.58, 88.66)];
[starPath addLineToPoint: CGPointMake(249.74, 88.45)];
[starPath addLineToPoint: CGPointMake(174.24, 143.03)];
[starPath addLineToPoint: CGPointMake(203.24, 231.55)];
[starPath addLineToPoint: CGPointMake(128, 176.62)];
[starPath addLineToPoint: CGPointMake(52.76, 231.55)];
[starPath addLineToPoint: CGPointMake(81.76, 143.03)];
[starPath addLineToPoint: CGPointMake(6.26, 88.45)];
[starPath addLineToPoint: CGPointMake(99.42, 88.66)];
[starPath closePath];
self.view.layer.mask = maskLayer;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment