#import "UIView+RoundedCorners.h" #import @implementation UIView (RoundedCorners) - (void)setRoundedCorners:(UIRectCorner)corners radius:(CGSize)size { UIBezierPath* maskPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:corners cornerRadii:size]; CAShapeLayer* maskLayer = [CAShapeLayer new]; maskLayer.frame = self.bounds; maskLayer.path = maskPath.CGPath; self.layer.mask = maskLayer; } @end