¿Alguien tiene alguna idea de por qué CGContextFillPath no funcionará en el siguiente fragmento de código? Estoy usando el siguiente código para dibujar a un UIImageView. Está acariciando el camino correctamente, pero ignorando CGContextFillPath.Dibujo de línea CGContext: CGContextFillPath no funciona?
UIGraphicsBeginImageContext(self.frame.size);
[drawingView.image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 5.0);
CGContextSetAllowsAntialiasing(UIGraphicsGetCurrentContext(), YES);
CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), 1.0, 0.0, 0.0, 1.0);
CGContextSetRGBFillColor(UIGraphicsGetCurrentContext(), 1.0, 0.0, 0.0, 1.0);
CGContextBeginPath(UIGraphicsGetCurrentContext());
CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), firstMovedTouch.x, firstMovedTouch.y);
CGContextStrokePath(UIGraphicsGetCurrentContext());
CGContextFillPath(UIGraphicsGetCurrentContext());
drawingView.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
Oh ... tienes razón. Estoy usando el código para el dibujo de líneas del dedo del gueto. Pero eso tiene sentido. Este código se activa en touchesMoved: y funciona muy bien para los dibujos lineales, pero tendré que guardar todos los puntos en una matriz, o algo así, para completar la ruta una vez que el usuario levanta el dedo. – RyJ