Skip to content

Instantly share code, notes, and snippets.

@zld
Last active September 18, 2016 10:30
Show Gist options
  • Save zld/db5bfe3c0a4361f97dc9e02153ac8ec9 to your computer and use it in GitHub Desktop.
Save zld/db5bfe3c0a4361f97dc9e02153ac8ec9 to your computer and use it in GitHub Desktop.
-(void)addRoundedCorners:(UIRectCorner)corners withRadii:(CGSize)radii {
CAShapeLayer *maskLayer = [CAShapeLayer layer];
maskLayer.frame = self.bounds;
UIBezierPath *roundedPath = [UIBezierPath bezierPathWithRoundedRect: maskLayer.bounds byRoundingCorners:corners cornerRadii:radii];
// maskLayer.fillColor = [[UIColor yellowColor] CGColor];
maskLayer.backgroundColor = [[UIColor clearColor] CGColor];
maskLayer.path = [roundedPath CGPath];
self.layer.mask = maskLayer;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment