Sto provando a disegnare una linea tratteggiata con CGContextSetLineDash
.Disegno di una linea tratteggiata con CGContextSetLineDash
Ecco il mio codice:
float dashPhase = 0.0;
float dashLengths[] = {30, 30};
CGContextSetLineDash(context, dashPhase, dashLengths, 20.0);
self.previousPoint2 = self.previousPoint1;
self.previousPoint1 = previous;
self.currentPoint = current;
self.mid1 = [self pointBetween:self.previousPoint1 andPoint:self.previousPoint2];
self.mid2 = [self pointBetween:self.currentPoint andPoint:self.previousPoint1];
UIBezierPath* newPath = [UIBezierPath bezierPath];
[newPath moveToPoint:self.mid1];
[newPath addLineToPoint:self.mid2];
[newPath setLineWidth:self.brushSize];
Tuttavia, se disegno lentamente, linee tratteggiate non appaiono (vedi parte superiore dell'immagine qui sotto), ma se io disegnare rapidamente, lo fanno apparire (vedi parte inferiore dell'immagine qui sotto).
Perché succede questo?
Non vedo come questo sia correlato a Xcode. –