首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >lineWidth for UIBezierPath有最大值

lineWidth for UIBezierPath有最大值
EN

Stack Overflow用户
提问于 2014-07-27 04:12:45
回答 1查看 259关注 0票数 0

我试图创造一个弧线,像一个半圆,我可以用不同的颜色动画。我想我应该从创建弧形的bezier路径开始,并将线宽设置为较大的宽度。到目前为止,这就是我所拥有的:

代码语言:javascript
复制
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;

然而,当我看到我的弧形时,它看上去并没有比一条薄薄的路径大多少。这就是创造这样的东西的方法吗?还是我需要创建两条路径,并以某种方式填充它们之间的区域?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-07-27 05:09:21

你需要设置图层的lineWidth,而不是贝塞尔路径,

代码语言:javascript
复制
layer.lineWidth = 100;
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24977842

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档