I want to get notifications when user single tap or double tap on imageView of UITableViewCell. I have been try to add a subview to imageView, and use touchesBegan:withEvent: in subview controller, but can’t trigger the event I expected. How can I do the job ?
Share
In my project I have subclassed UIImageView to add user interaction, if it can be useful you can simply have a look at the Apple Sample Code, project “TapToZoom”.
In shorts, you have to enable user interaction, and only after that the UIImageView will start to answer to touches.
This is done by setting userInteractionEnabled property:
then you can customize other touches property by, for example:
Otherwise, you could be implementing a sort of thumbnails view like the photo app, let’s say. Depending on your objective, you can also think about using a UIButton, where you can set a background image. I have a project where I mimic the photo thumbnail view of the original photo app simply by putting programmatically four UIButtons in each tableView row, and it works fine.
Cheers