>  Q&A  >  본문

objective-c - iOS UIBezierPath画线如何删除已有的线

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

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

为情所困为情所困2751일 전1184

모든 응답(1)나는 대답할 것이다

  • 我想大声告诉你

    我想大声告诉你2017-05-02 09:31:25

    self.pathLayer = [CAShapeLayer layer]; 앞에

    추가 으아아아

    회신하다
    0
  • 취소회신하다