Answer the question
In order to leave comments, you need to log in
How to increase UITouch reviews?
How can I increase the number of calls
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
per unit of time?
I am writing a drawing application, drawing occurs during the call of this function, as a result of which everything is fine with a slow movement of the finger, but with fast movements, gaps are obtained.
It is not possible to connect the dots with each other, since it is not the drawing itself that is going on, but the restoration of the image (copying sections of the image).
Update
When pressed and moved, this function is called:
- (void)eraseInPoint:(CGPoint)point {
float x = point.x-brushSize/2, y = point.y-brushSize/2;
float width = brushSize, height = brushSize;
CGRect dirtyRect = CGRectMake(x, y, width, height);
CGRect drawRect = dirtyRect;
drawRect.origin.y = self.bounds.size.height-drawRect.origin.y-drawRect.size.height;
CGImageRef erase = CGImageCreateWithImageInRect(startedImage, drawRect);
CGContextDrawImage(cacheContext, dirtyRect, erase);
CGImageRelease(erase);
[self setNeedsDisplayInRect:dirtyRect];
}
Answer the question
In order to leave comments, you need to log in
Most likely you are trying to "draw" in the touchesMoved method, which eats up resources and the program starts to stumble. try removing the drawing code and see if the method call becomes more frequent. if so, then in the touchesMoved method you simply remember the coordinates, and in parallel, by tayier (or in some other way), start redrawing the screen, choosing the frequency empirically.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question