UIView *bgView = [TDHPCreateViewTool createView:[UIColor clearColor]];
[self addSubview:bgView];
//利用班赛尔曲线画角
bgView.frame = CGRectMake(15, 14, SCREEN_WIDTH - 30, 42 - 14);
CAShapeLayer *maskLayer = [CAShapeLayer layer];
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:bgView.bounds byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight) cornerRadii:CGSizeMake(15, 15)]; //byRoundingCorners方向 cornerRadii 圆角的角度
maskLayer.path = maskPath.CGPath;
maskLayer.fillColor = [UIColor whiteColor].CGColor; //内容填充的颜色
maskLayer.strokeColor = rgb(255,255 ,255).CGColor; //边色
maskLayer.lineWidth = 1.0f; //*这里注意是lineWidth,区别于borderWidth
maskLayer.frame = bgView.bounds;
[bgView.layer addSublayer:maskLayer];
网友评论