Heres the code where im adding the gesture recognizers
UIImage *img = [UIImage imageWithContentsOfFile:media.thumbnailPath];
UIImageView *imageView = [[UIImageView alloc] init];
imageView.image = img;
imageView.contentMode = UIViewContentModeScaleToFill;
imageView.backgroundColor =[UIColor blackColor];
//Add tap guesture
UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)];
UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTap:)];
[singleTap setNumberOfTapsRequired:1];
[singleTap setDelegate:self];
[doubleTap setNumberOfTapsRequired:2];
[doubleTap setDelegate:self];
[singleTap requireGestureRecognizerToFail:doubleTap];
[imageView addGestureRecognizer:singleTap];
[imageView addGestureRecognizer:doubleTap];
[singleTap release];
[doubleTap release];
and i have implemented the
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
NSLog(@"Gesturing");
return YES;
}
but the delegate method is not called when dealing with the singletap gesture but it works for doubletap gesture
Check out Simultaneous gesture recognizers in Iphone SDK
Setting Gesture Recognizers
Method implementation