佚名通过本文主要向大家介绍了趋势线自动画线指标,cad画线不显示线,黄金分割线画线工具,凹口平衡线画线公式,灯塔线的取点画线等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
问题: iOS UIBezierPath画线如何删除已有的线
描述:
解决方案1:
描述:
生成线的代码:
self.path = [UIBezierPath bezierPath];
[self.path moveToPoint:from];
[self.path addLineToPoint:to];
self.pathLayer = [CAShapeLayer layer];
self.pathLayer.frame = containerView.bounds;
self.pathLayer.path = self.path.CGPath;
self.pathLayer.strokeColor = color.CGColor;
self.pathLayer.lineWidth = 2.0f;
self.pathLayer.lineJoin = kCALineJoinBevel;
NSMutableArray *ary = [NSMutableArray arrayWithArray:shapeLayers];
[ary addObject:self.pathLayer];
shapeLayers = [NSMutableArray arrayWithArray:ary];
[containerView.layer addSublayer:self.pathLayer];
如何将上述线删除,在画新线
解决方案1:
self.pathLayer = [CAShapeLayer layer];
之前加上
if (self.pathLayer) {
[self.pathLayer removeFromSuperlayer];
}