Besides subclassing, is there a simple means to detect double taps on a UIImageView within a UIScrollView?
Thanks
John
Besides subclassing, is there a simple means to detect double taps on a UIImageView within a UIScrollView?
Thanks
John
Looking at UIImageView.h
(within the UIKit
framework) there are no public delegate methods or other methods that let you know if the image view has been double-tapped. You'll probably have to subclass.
I have created ZoomScrollView class (a drop-in subclass of UIScrollView) that can help you intercept any touches from a scroll view, and also handles double-tap zooming out of the box if that's what you want to do.
Grab it at github.com/andreyvit/ScrollingMadness/ (the README contains a long description of two UIScrollView tricks and the reasoning behind them).
Of course, if you did not want to zoom, and just wanted to intercept a double-tap on some inner image view, then subclassing is your friend. (Another way would be to attach a view controller to that image view or one of its parent views inside UIScrollView, then the controller will be part of the responder chain and will be able to handle the touches.)
The answer is NO.
http://developer.apple.com/library/ios/#samplecode/ScrollViewSuite/Introduction/Intro.html
Download the sample code (download link on the top). See how apple did it.
See you.