Repeat count for UIView block-based animation

2019-04-04 15:06发布

I've looked at the methods for block based animation and noticed there is no equivalent parameter or option for [UIView setAnimationRepeatCount:].

What's the simplest way to repeat an animation a fixed number of times? Do you, for instance, chain them using the completion block?

3条回答
冷血范
2楼-- · 2019-04-04 15:28

As @PommeOuest mentioned. You can still user [UIView setAnimationRepeatCount:] inside the animation block. I just tried in my project and it works well.

I'm using XCode4 and iOS5.

查看更多
对你真心纯属浪费
3楼-- · 2019-04-04 15:36

I just asked a similar question and then I read the 2010-11-15 release of the View Programming Guide for iOS. Page 64 caught my attention.

In the animation block, one can still use the [UIView setAnimationRepeatCount:]. I thought that I could/should not. So my ability to read Apple doc needs to improve.

So perhaps this would solve your (and my need). I'm trying it later today

查看更多
来,给爷笑一个
4楼-- · 2019-04-04 15:42

Set a completion callback - re-initiate the animation in it - and keep track of the counter yourself.

查看更多
登录 后发表回答