@interface LYBezierPath : NSObject
/**
圆角处理
@param view 需要圆角化的视图
@param corners 需要圆角的边角
@param radii 需要圆角的尺寸
@return CAShapeLayer
*/
+(CAShapeLayer *)superView:(UIView *)view
Corners:(UIRectCorner)corners
Radii:(CGSize)radii;
@end
@implementation LYBezierPath
+(CAShapeLayer *)superView:(UIView *)view
Corners:(UIRectCorner)corners
Radii:(CGSize)radii{
UIBezierPath *maskPath = [UIBezierPath
bezierPathWithRoundedRect:view.bounds
byRoundingCorners:corners
cornerRadii:radii];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = view.bounds;
maskLayer.path = maskPath.CGPath;
return maskLayer;
}
@end