开发者

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 curre开发者_如何学Cnt offset in the middle of an animation?


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

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

Ray


Swift 5

scrollview.layer.presentation()?.bounds.origin
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜