cari

Rumah  >  Soal Jawab  >  teks badan

objektif-c - lukisan garisan iOS UIBezierPath cara memadamkan garisan sedia ada

Kod untuk menjana baris:
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];

Bagaimana untuk memadamkan garisan di atas dan melukis yang baharu

为情所困为情所困2822 hari yang lalu1237

membalas semua(1)saya akan balas

  • 我想大声告诉你

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

    Tambah self.pathLayer = [CAShapeLayer layer]; sebelum

    if (self.pathLayer) {
            [self.pathLayer removeFromSuperlayer];
        }

    balas
    0
  • Batalbalas