Reputation: 4778
In my app i need to know if the user is touching with two fingers or only one. How can i do this?. I have this code that works, but i only get where is the touch. How can i determine how many fingers are touching the view?
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
NSLog(@"touch at %@", NSStringFromCGPoint([touch locationInView:touch.view]));
return YES;
}
Need help please. Thanks in advance.
Upvotes: 0
Views: 1645
Reputation: 14030
In your target's action selector, you'll have access to [gesture numberOfTouches]
.
UIGestureRecognizer *gesture = [[UIGestureRecognizer alloc] initWithTarget:self action:@selector(myResponder:)];
- (void)myResponder:(UIGestureRecognizer *)gesture {
[gesture numberOfTouches];
}
Upvotes: 3