0

I am attempting to disable scrolling a UIScrollView after scrollViewDidEndDragging is called. I want the UIScrollView to only scroll when the user is scrolling with his/her finger. I haven't found a good way to implement this yet. I have attempting to disable and the enable scrolling, but when I use a flick motion to scroll, the UIScrollView continues scrolling. What I have in my code right now is:

func scrollViewDidEndDragging(scrollView: UIScrollView, willDecelerate decelerate: Bool) {
    scrollView.setContentOffset(self.contentOffset, animated: false)
    scrollView.scrollEnabled = false
    scrollView.scrollEnabled = true
    ... 
}

Does anyone know how to immediately stop scrolling if a flick scroll motion is performed?

Mike Walker
  • 2,944
  • 8
  • 30
  • 62
  • i'd subclass the scrollview and make my own `scrollViewWillBeginDecelerating:` function – Chris Slowik Sep 23 '15 at 20:16
  • 1
    @ChrisSlowik it was a duplicate. If I used the `scrollViewWillEndDragging` method and set `targetContentOffset.memory = scrollView.contentOffset` then it works perfect. – Mike Walker Sep 23 '15 at 20:38
  • awesome! yea thats a super handy thing to override. i just built a paired scroll view with parallax and used that. glad you got it figured out. – Chris Slowik Sep 24 '15 at 01:05

0 Answers0