常用代码片段
2022-06-04 本文已影响0人
蓝天白云_Sam
View 特效
半边圆角
- (void)makecornerRadiusByRoundingCorners:(UIRectCorner)roundingCorners cornerRadii:(CGSize)cornerRadii
{
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:roundingCorners cornerRadii:cornerRadii];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = self.bounds;
maskLayer.path = maskPath.CGPath;
self.layer.mask = maskLayer;
}
渐变