Я рисую форму UIBezierPath в touchhesMoved.Как заполнить цвет внутри 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];
}
Я хочу заполнить красный цвет внутри него после закрытия, но не может. Пожалуйста помоги!
- (void)drawRect:(CGRect)rect
{
UIColor *fillColor = [UIColor redColor];
[fillColor setFill];
UIColor *strokeColor = [UIColor blueColor];
[strokeColor setStroke];
[bezierPath closePath];
[bezierPath fill];
[bezierPath stroke];
}
Не похоже, что вы на самом деле поглаживаете путь, поэтому некому закрыть. – Abizern
Не могли бы вы дать ответ. Я так не понимаю. Благодаря! –
Позвольте мне угадать? вы не получаете форму, просто линию? Каждый раз, когда ваш прикосновение перемещается, он закрывает текущий подпуть. – Abizern