Repeat an animation a variable number of times

后端 未结 4 1151

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

    Did you try to set the repeatCount? + (void)setAnimationRepeatCount:(float)repeatCount

    I've tried the following code block, and it definitely repeats 2x for me (l was a UITextView that was scaled up by 2x in X dir and 3X in Y dir):

    [UIView animateWithDuration:2 
    delay:0.1 
    options:UIViewAnimationOptionCurveEaseIn 
    animations:^{ [UIView setAnimationRepeatCount:2]; 
    l.transform = CGAffineTransformMakeScale(2,3); } completion:nil];
    

提交回复
热议问题