Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get UIScrollView contentOffset during an animation

I am trying to get the contentOffset property of a UIScrollView in the middle of a setContentOffset animation. Note I am not using the animated property of the method, but instead enclosing the setContentOffset operation within a UIView animation block so I can have finer control.

When I try to read the value of contentOffset in the middle of the animation, it returns the final value rather than the value at that moment. I know that you can use the presentationLayer to get the current layer, but is there any way you can get the current offset in the middle of an animation?

like image 944
Jerry SHen Avatar asked Mar 21 '10 16:03

Jerry SHen


1 Answers

Took me a while to figure this out too. Try.........

CGPoint offset = [myScroll.layer.presentationLayer bounds].origin

Ray

like image 112
Ray Avatar answered Oct 05 '22 21:10

Ray