I need to detect an event with two fingers. If I touch the screen with two fingers at the same time, then everything is in order. Just using a code like this:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [[touches allObjects] objectAtIndex:0]; CGPoint point1 = [touch locationInView:self]; CGPoint point2 ; NSLog(@"First: %f %f", point1.x, point1.y) ; if ([[touches allObjects] count] > 1) { UITouch *touch2 = [[touches allObjects] objectAtIndex:1]; point2 = [touch2 locationInView:self]; NSLog(@"Second: %f %f", point2.x, point2.y) ; } }
But this code does not work if I hold one finger and then touch the screen with the other finger. How to implement this? Is it hard to do?
objective-c iphone
kesrut
source share