Does anyone know how to determine which direction a scroll view will move when the user lifts their finger, i.e. when scrollViewDidEndDragging gets called?
Specifically, when the scroll view is set to paging.
Most of the time, I can just track and check the contentOffset in scrollViewDidScroll, however, there are special cases where the user flicks the screen quickly. In some cases a LEFT-RIGHT-LEFT move will scroll to the next page, and in others, the same pattern will remain on the same page.
I’m guessing it has something to do the with acceleration (difference between the last few points) of the touch.
(I’m on iOS4.3 on an iPad)
This is a tricky one, iOS 5 has the answer, but that no good for you.
Perhaps a hacky workaround is to set a
NSTimerfor a small time interval (say 0.1 seconds) afterscrollViewDidEndDraggingfinished. Then compare the content offsets.If you want to know if the scroll view will actually go to the next page, perhaps you could check if the content offset has gone more than 1/2 way. You could read the content offset on
scrollViewDidScroll:and do a bit of maths to determine if its more than 1/2 way.