UIView animateWithDuration等到动画结束

and*_*111 5 animation ios

触摸按钮后我正在运行动画.如果用户在当前动画结束之前触摸按钮,我希望新动画等到当前动画结束.我怎么能这样做?

Cod*_*aFi 11

将它与UIView的animateWithDuration包装器的完成变体嵌套,如下所示:

[UIView animateWithDuration:1.00 animations:^{
    //animate first!
    } 
                     completion:^(BOOL finished) {
                         [UIView animateWithDuration:1.00 animations:^{
                         //animate the second time.
                         }];
    }];
Run Code Online (Sandbox Code Playgroud)

或者只是将一个动画设置为从当前状态继续:

[UIView animateWithDuration:1.00 
                          delay:0.00 
                        options:UIViewAnimationOptionBeginFromCurrentState 
                     animations:^{
                         //animate
                     } 
                     completion:^(BOOL finished){

    }];
Run Code Online (Sandbox Code Playgroud)