Skip to content

Instantly share code, notes, and snippets.



Last active Dec 16, 2016
What would you like to do?
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
You can’t perform that action at this time.