Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios UIBezierPath的线宽具有最大值_Ios_Objective C - Fatal编程技术网

Ios UIBezierPath的线宽具有最大值

Ios UIBezierPath的线宽具有最大值,ios,objective-c,Ios,Objective C,我试图创建一个弧,像一个半圆,我可以用不同的颜色来设置动画。我想我应该先为圆弧创建一个贝塞尔路径,然后将线宽设置为较大的值。这就是我到目前为止所做的: CAShapeLayer *layer = (CAShapeLayer *)self.layer; UIBezierPath *bezierPath = [UIBezierPath bezierPath]; CGPoint startPoint = CGPointMake(self.bounds.origin.x, self.bounds.or

我试图创建一个弧,像一个半圆,我可以用不同的颜色来设置动画。我想我应该先为圆弧创建一个贝塞尔路径,然后将线宽设置为较大的值。这就是我到目前为止所做的:

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;

但当我看到我的弧线时,它看起来并不比一条细路径大。这是创造这样东西的方法吗?或者我需要创建两条路径并以某种方式填充它们之间的区域吗?

您需要设置层的线宽,而不是贝塞尔路径

layer.lineWidth = 100;