iOS view 切任意角圆角

2020-07-02  本文已影响0人  静守幸福
// UIRectCornerTopLeft | UIRectCornerTopRight 控制切角位置   cornerRadii 圆角大小 view 需要切圆角的view
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:view.bounds byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(19*kWidthScale, 19*kWidthScale)];
           CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
           maskLayer.frame = view.bounds;
           maskLayer.path = maskPath.CGPath;
           view.layer.mask = maskLayer;
上一篇 下一篇

猜你喜欢

热点阅读