I want the scroll view just scrolls vertically and I also try to capture horizontal swipes on the scroll view.
I try to subclass UIScrollView and override some method about touch event, but all failed.
The problem seems to be that when a user swipes horizontally with some accidental vertical movement(even just a little), the UIScrollView scrolls and my touchesEnded delegate method never gets called.
Instead of overriding
touchesBegan:withEvent:and other methods, use aUISwipeGestureRecognizer. It’s much simpler.“Gesture Recognizers” in the Event Handling Guide for iOS
UISwipeGestureRecognizer Class Reference