Reputation: 8329
Is it possible to handle Touch and Tap gestures recognition simultaneously with UIGestureRecognizer?
Upvotes: 0
Views: 2192
Reputation: 281
You can use touch methods and gestures as long as you set cancelsTouchesInView to NO on the gesture.
Upvotes: 0
Reputation: 1929
I don't know what kind of recognizer you mean with touch, but i suppose you mean something like pan. But yes, it is possible, simply by creating multiple gesturecognizers. Example:
UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(handleTap:)];
UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(handlePan:)];
[self.view addGestureRecognizer:tapRecognizer];
[self.view addGestureRecognizer:panRecognizer];
I'm assuming you know the basics of gesturerecognizers. If not, i'll be happy to give you a link to a tutorial and help you with any additional questions. However, if they both use the same kind of gesture (like pan and swipe, or a single and double tap recognizer), you will need to use requiresgesturerecognizertofail.
Upvotes: 4