Two UITapGestureRecognizer in on UIView
ios, iphone, objective-c
Solution
use this one..
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGesture)];
tapGesture.numberOfTapsRequired = 2;
[self.view addGestureRecognizer:tapGesture];
[tapGesture release];
UITapGestureRecognizer *tapGesture2 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGesture2)];
tapGesture2.numberOfTapsRequired = 1;
[tapGesture2 requireGestureRecognizerToFail: tapGesture];
[self.view addGestureRecognizer:tapGesture2];
[tapGesture2 release];
Problem
I want to add to my `UIViewController` : ``` UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGesture:)]; tapGesture.numberOfTapsRequired = 2; [self.view addGestureRecognizer:tapGesture]; [tapGesture release]; UITapGestureRecognizer *tapGesture2 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGesture2:)]; tapGesture2.numberOfTapsRequired = 1; [self.view addGestureRecognizer:tapGesture2]; [tapGesture2 release]; ``` the problem is if the user tap twice the two methods are called,and i want that if the user make double tap only the first(handleTapGesture) will be called and if he make one tap it will call only the second one(handleTapGesture2)