Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. CGRect rect = self.bounds;
  2.  
  3. // Create the path
  4. UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:rect
  5. byRoundingCorners:corners
  6. cornerRadii:CGSizeMake(radius, radius)];
  7.  
  8. // Create the shape layer and set its path
  9. CAShapeLayer *maskLayer = [CAShapeLayer layer];
  10. maskLayer.frame = rect;
  11. maskLayer.path = maskPath.CGPath;
  12.  
  13. // Set the newly created shape layer as the mask for the view's layer
  14. self.layer.mask = maskLayer;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement