I have a simple app that prints the coordinates of all the touches event. In the simulator it works great.
On my device (iPhone) it works great with up to two fingers. When I tap with three fingers in a fast sequence the event touchesCancelled
is triggered.
Could someone please explain this to me? This is the code for printing (in case the problem lays there) that sits in my UIView.
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
for (UITouch *touch in touches) {
CGPoint location = [touch locationInView:touch.view];
NSLog(@"Began %f %f", location.x, location.y);
}
}
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
for (UITouch *touch in touches) {
CGPoint location = [touch locationInView:touch.view];
NSLog(@"Moved %f %f", location.x, location.y);
}
}
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
for (UITouch *touch in touches) {
CGPoint location = [touch locationInView:touch.view];
NSLog(@"Ended %f %f", location.x, location.y);
}
}
-(void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{
NSLog(@"Phase: Touches cancelled");
for (UITouch *touch in touches) {
CGPoint location = [touch locationInView:touch.view];
NSLog(@"Cancelled %f %f", location.x, location.y);
}
}
An example of sequence is this one:
Began 38.000000 263.000000
Began 173.500000 238.500000
Moved 41.500000 263.000000
Phase: Touches cancelled <<<< third touch
Cancelled 41.500000 263.000000
Cancelled 173.500000 238.500000
Thank you.