When user "flicks" a UIScrollView
, causing it to scroll with momentum, is there a way to figure out the final contentOffset
before the deceleration ends?
Basically, I would like to know what the ultimate contentOffset
is from inside scrollViewDidEndDragging:willDecelerate:
instead of scrollViewDidEndDecelerating:
There is a float property called decelerationRate
, which might be one piece of the puzzle, but I have yet to figure out what to do with it.
PS: I have pagingEnabled
set to YES
. In iOS 5, there is actually scrollViewWillEndDragging:withVelocity:targetContentOffset:
, but the doc says it's not fired if pagingEnabled
is YES
As I noticed the max contentOffset can be calculated from the start it's just a difference between the scrollview contentSize and scrollview frame size. I calculated it on y like this. maxOffsetY = scrollView.contentSize.height - scrollview.frame.size.height;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With