半圆角

261 阅读1分钟
[CATransaction begin];
[CATransaction setDisableActions:YES];

_shapeLayer.frame = CGRectMake(0, contentOffSetY, self.width, self.height - 15 + ABS(contentOffSetY));

[CATransaction commit];

UIBezierPath *bezierPath = [UIBezierPath bezierPath];

[bezierPath moveToPoint:CGPointMake(0, 0)];

[bezierPath addLineToPoint:CGPointMake(0, _shapeLayer.frame.size.height - 15)];

[bezierPath addQuadCurveToPoint:CGPointMake(_shapeLayer.frame.size.width,
_shapeLayer.frame.size.height - 15) controlPoint:CGPointMake(_shapeLayer.frame.size.width / 2, _shapeLayer.frame.size.height + 15)];

[bezierPath addLineToPoint:CGPointMake(_shapeLayer.frame.size.width, 0)];

[bezierPath addLineToPoint:CGPointMake(0, 0)];

_shapeLayer.path = bezierPath.CGPath;