objective-c - iOS UIBezierPath画线如何删除已有的线
为情所困
为情所困 2017-05-02 09:29:25
0
1
1181

生成线的代码:
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];

如何将上述线删除,在画新线

为情所困
为情所困

reply all(1)
我想大声告诉你

Add

before self.pathLayer = [CAShapeLayer layer];

if (self.pathLayer) {
        [self.pathLayer removeFromSuperlayer];
    }
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!