开发者

Animate while UIScrollView bounces

开发者 https://www.devze.com 2023-03-31 03:04 出处:网络
I want to do a little animation every time the UIScrollView bounces, to be exact, I want a button to move a little bit to the left and then back to it\'s original position. I use the scrollViewDidScro

I want to do a little animation every time the UIScrollView bounces, to be exact, I want a button to move a little bit to the left and then back to it's original position. I use the scrollViewDidScroll method and check if the scrollView's contentOffset is higher than the actual content height and then call the animation. The problem is that the ani开发者_如何学Gomation is called multiple times during the bounce if I do it like that. Is there a way to only call it once?


Have an ivar or property named something like animationActive that will keep track of animation. When you start it, set animationActive = YES; and when animation completes, set animationActive = NO;. And of course, before you start animation, check if (animationActive == YES).

0

精彩评论

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

关注公众号