Repeat an animation a variable number of times

后端 未结 4 1163

I was wondering how I can set an animation to repeat. The number of repetitions needs to be determined by a variable. In the following code, the variable int newPage

4条回答
  •  佛祖请我去吃肉
    2021-02-19 09:59

    the reason you arent seeing but one animation is that due to the fact that you are calling the animation from a loop in the same runloop, resuting in the last call winning (one animation)

    instead of calling [self animatePage], try calling

    [self performSelector:@selector(animatePage) withObject:nil afterDelay:.1 *temp];
    

    this will create your calls on separate threads.

    you may need to play with the delay interval

提交回复
热议问题