I have a UIScrollView with subclassed UIImageViews in it. When one of the imageviews are clicked, I’d like the parent UIView (contains the scrollview) to receive the event in its
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
I can tell if the imageview was clicked by
if(CGRectContainsPoint(myScrollView.frame, location) == YES){...}
Assuming the imageview and scrollview are the same size. Or is there a better way to to know a particular imageview within the scrollview was tapped? The imageviews are created dynamically.
Note that
UIImageViewignores touches (or rather, lets them pass through to its superview) by default. Make sure you set your image views’userInteractionEnabledproperty to YES.