贝塞尔曲线绘制圆角

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:_baseView.bounds byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(5, 5)];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc]init];
//设置大小
maskLayer.frame = _baseView.bounds;
//设置图形样子
maskLayer.path = maskPath.CGPath;
_baseView.layer.mask = maskLayer;

注意:如果在tableVIewCell的- (void)awakeFromNib {}方法中是要给frame,因为这个方法只加载xib原本的尺寸,导致布局会有问题

转载于:https://my.oschina.net/u/2519763/blog/1516606

你可能感兴趣的:(贝塞尔曲线绘制圆角)