Rysuję kształt według UIBezierPath w dotknięciach Move.Jak wypełnić kolor wewnątrz 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];
}
Chcę wypełnić czerwony kolor wewnątrz niego po ścieżce closePath, ale nie może. Proszę pomóż!
- (void)drawRect:(CGRect)rect
{
UIColor *fillColor = [UIColor redColor];
[fillColor setFill];
UIColor *strokeColor = [UIColor blueColor];
[strokeColor setStroke];
[bezierPath closePath];
[bezierPath fill];
[bezierPath stroke];
}
Wygląda na to, że właściwie nie obrysowuje się ścieżki, więc nie można jej zamknąć. – Abizern
Czy możesz udzielić odpowiedzi.Nie rozumiem tak wiele. Dzięki! –
Niech zgadnę? nie dostaniesz kształtu, tylko linię? Za każdym razem, gdy poruszasz dotykiem, zamyka bieżącą ścieżkę podrzędną. – Abizern