Disegno una forma di UIBezierPath nei tocchi spostati.Come riempire il colore all'interno di UIBezierPath?
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
secondPoint = firstPoint;
firstPoint = [touch previousLocationInView:self];
currentPoint = [touch locationInView:self];
CGPoint mid1 = midPoint(firstPoint, secondPoint);
CGPoint mid2 = midPoint(currentPoint, firstPoint);
[bezierPath moveToPoint:mid1];
[bezierPath addQuadCurveToPoint:mid2 controlPoint:firstPoint];
[self setNeedsDisplay];
}
Desidero riempire il colore ROSSO al suo interno dopo closePath ma non è possibile. Per favore aiuto!
- (void)drawRect:(CGRect)rect
{
UIColor *fillColor = [UIColor redColor];
[fillColor setFill];
UIColor *strokeColor = [UIColor blueColor];
[strokeColor setStroke];
[bezierPath closePath];
[bezierPath fill];
[bezierPath stroke];
}
Non sembra che si stia effettivamente accarezzando un percorso, quindi non ce n'è uno da chiudere. – Abizern
Potresti dare una risposta. Non capisco molto. Grazie! –
Fammi indovinare? non hai una forma, solo una linea? Ogni volta che il tuo tocco si sposta, chiude il sottotracciato corrente. – Abizern