Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CGRect rect = self.bounds;
- // Create the path
- UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:rect
- byRoundingCorners:corners
- cornerRadii:CGSizeMake(radius, radius)];
- // Create the shape layer and set its path
- CAShapeLayer *maskLayer = [CAShapeLayer layer];
- maskLayer.frame = rect;
- maskLayer.path = maskPath.CGPath;
- // Set the newly created shape layer as the mask for the view's layer
- self.layer.mask = maskLayer;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement