使用UIBezierPath给视图添加圆角
作者:
蛋哥是只猫 | 来源:发表于
2017-03-21 16:05 被阅读0次- (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;
}
本文标题:使用UIBezierPath给视图添加圆角
本文链接:https://www.haomeiwen.com/subject/bmjgnttx.html
网友评论