1

I really need touchesMoved(...) method in UIScrollView. I know that there is a method scrollViewDidScroll(...), but I really need the other method.

So I create subclass of UIScrollView and implement those methods.

class MyScrollView: UIScrollView {
    ...
    override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
        super.touchesMoved(touches, with: event)
        print("Move")
    }

    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        super.touchesBegan(touches, with: event)
        print("Touch")
    }
}

If I click on the scroll view I get (let say I click two times) :

Touch
Touch

If I click on scroll view and wait a second and then move my finger I get :

Touch
Move
Move

But then scroller start to scroll and I don't receive anything anymore. Why scroll gesture doesn't call those methods?

How do I persuade scroll view to call those methods on scroll?

Marko Zadravec
  • 8,298
  • 10
  • 55
  • 97
  • please check http://stackoverflow.com/questions/16939503/uiscrollview-and-content-with-requires-touch-move-events – Prashant Tukadiya Feb 24 '17 at 10:02
  • I don't understand what this question has with mine. I would like to detect scroll, he would like to scroll view with two fingers (not detect them,...). – Marko Zadravec Feb 24 '17 at 10:07
  • check : http://stackoverflow.com/questions/12259005/uiscrollview-with-touchesmoved-not-called and this : http://stackoverflow.com/questions/15541276/touch-events-touchesmoved-not-working-on-uiviews-inside-uiscrollview – Priyal Feb 24 '17 at 10:17
  • Possible duplicate of [Detect touch position on UiScrollView](https://stackoverflow.com/questions/15762401/detect-touch-position-on-uiscrollview) – Łukasz Gierałtowski Sep 13 '17 at 11:10

0 Answers0