- (UIView *)clipView:(UIView *)originView roundingCorners:(UIRectCorner)corners cornerRadii:(CGSize)cornerRadii{
UIBezierPath * maskPath = [UIBezierPath bezierPathWithRoundedRect:originView.bounds byRoundingCorners:corners cornerRadii:cornerRadii];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = originView.bounds;
maskLayer.path = maskPath.CGPath; // 轨迹
originView.layer.mask = maskLayer;
return originView;
}
网友评论