/// 利用贝塞尔曲线添加指定位置圆角
/// @param view view
/// @param conrners 圆角位置
/// @param cornerRadii 圆角大小
- (void)BezierPathWithRoundedRect:(UIView *)view RoundingCorners:(UIRectCorner)conrners CornerRadii:(CGSize)cornerRadii {
[self layoutIfNeeded];
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:view.bounds byRoundingCorners:conrners cornerRadii:cornerRadii];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = view.bounds;
maskLayer.path = maskPath.CGPath;
view.layer.mask = maskLayer;
}
[self layoutIfNeeded];
加上这句就好用了
网友评论