贝塞尔曲线绘制圆角

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本来的尺寸,致使布局会有问题布局

相关文章
相关标签/搜索