I'm making a painting application in iOS . I'll give a brief outline of the logic here ,
1.Initialize a bitmap
2.Whenever a touchBegan or touchMoved event is detected , I draw a filled CGRect at that position on the bitmap and the bitmap is drawn to screen.
It works perfectly except for a little problem . If I move the mouse in the simulator really fast I dont get a continuous stroke . Its just a series of disconnected CGRects . I did some research which showed that in iOS touch events are fired only every 16 milliseconds but I dont think I'm moving the mouse that fast . So is the problem with the simulator or my code ?
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
CGPoint touchPoint=[touch locationInView:self];
CGContextFillRect (currentBitmap, CGRectMake (touchPoint.x -8 , touchPoint.y - 8 , rectangularBrushSize, rectangularBrushSize ));
[self setNeedsDisplay]; //draw currentBitmap to screen
}
The code for touchesMoved is the same . The draw rect method draws currentBitmap to the screen .I'd like to add once more that it works perfectly when I move the mouse with medium speed.