我正在做一个小项目,我想画一条贝塞尔曲线。我希望能够在绘图的不同部分改变lineWidth。
这就是我所拥有的:
CAShapeLayer *pathLayer = [CAShapeLayer layer];
pathLayer.frame = self.animationLayer.bounds;
pathLayer.bounds = pathRect;
pathLayer.geometryFlipped = YES;
pathLayer.path = path.CGPath;
pathLayer.strokeColor = [[UIColor blackColor] CGColor];
pathLayer.fillColor = nil;
pathLayer.lineWidth = 1.0f;
pathLayer.lineJoin = kCALineJoinBevel;我如何改变线条的宽度?一种解决方案可能是使用多个UIBezierPath和多个CAShapeLayer,但似乎应该有一个更简单、更优雅的解决方案(类似于在指定lineWidth行的级别指定UIBezierPath )。
谢谢!
发布于 2011-10-21 09:51:32
UIBezierPath只有一个lineWidth属性,所以不可能用一条路径绘制不同的线宽。您必须使用多个路径才能实现此效果。
https://stackoverflow.com/questions/7843661
复制相似问题