Reputation: 1070
I have a UIScrollView which contains multiple UIImageViews.
I want to know which UIImageView was tapped from the scrollview.
Thanks
Upvotes: 0
Views: 359
Reputation: 5038
Add gesture recognizer to image view and then open it in view controller (modal)
Use UIGestureRecognizerDelegate delegate
UITapGestureRecognizer *gestureTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(doubleTap:)];
gestureTap.delegate = self;
gestureTap.numberOfTapsRequired = 2;
[image addGestureRecognizer:gestureTap];
[gestureTap release];
- (void)doubleTap:(UIPanGestureRecognizer *)gesture {
NSLog(@"double tap on %@", gesture.view);
}
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer {
return YES;
}
Upvotes: 1