我试图创造一个弧线,像一个半圆,我可以用不同的颜色动画。我想我应该从创建弧形的bezier路径开始,并将线宽设置为较大的宽度。到目前为止,这就是我所拥有的:
CAShapeLayer *layer = (CAShapeLayer *)self.layer;
UIBezierPath *bezierPath = [UIBezierPath bezierPath];
CGPoint startPoint = CGPointMake(self.bounds.origin.x, self.bounds.origin.y + self.bounds.size.height / 2);
[bezierPath moveToPoint:startPoint];
layer.fillColor = [UIColor clearColor].CGColor;
layer.strokeColor = [UIColor redColor].CGColor;
CGFloat strokeSize = 10;
CGPoint endPoint = CGPointMake(self.bounds.origin.x + self.bounds.size.width, self.bounds.origin.y + self.bounds.size.height / 2);
[bezierPath setLineWidth:100];
[bezierPath addQuadCurveToPoint:endPoint controlPoint:CGPointMake(self.bounds.origin.x + self.bounds.size.width / 2, self.bounds.origin.y)];
bezierPath.lineCapStyle = kCGLineCapRound;
layer.path = bezierPath.CGPath;然而,当我看到我的弧形时,它看上去并没有比一条薄薄的路径大多少。这就是创造这样的东西的方法吗?还是我需要创建两条路径,并以某种方式填充它们之间的区域?
发布于 2014-07-27 05:09:21
你需要设置图层的lineWidth,而不是贝塞尔路径,
layer.lineWidth = 100;https://stackoverflow.com/questions/24977842
复制相似问题