0
votes

I'm developing an iOS 4.0 application.

I want to add a custom UIView over an image (UIImageView) to detect when user touches on some image's parts. I don't want to subclass UIImageView because I'm using SDWebImage package (or maybe I can subclass UIImageView+WebCache class to handle touches. If you tell me how).

This UIImageView will be inside an UIScrollView.

My idea is to detect when a user touches the image and notify viewController where user has touched. I don't need to detect moves or swipes or multitouches. Only one finger touch.

I'm creating my own UIView subclass to detect that using methods touchesBegan: touchesEnd:, etc. But I'm not sure if this is the best way to do that.

What do you think? Do you know a better approach?

1
I've found a tutorial about this: mobile.tutsplus.com/tutorials/iphone/…VansFannel

1 Answers

1
votes

You can add tapGestureRecognizer to your imageView in viewDidLoad, and then in handler method use CGPoint gestureLocation = [gestureRecognizer locationInView:self.imageView]; to check that tap was in selected area.