iphone – 如何获取动画结束通知

动画结束后,我想做一些动作.

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.80f];
self.view.transform = 
CGAffineTransformMakeTranslation(
                                 self.view.frame.origin.x, 
                                 480.0f + (self.view.frame.size.height/2)  // move the whole view offscreen
                                 );
[self.view setAlpha:0];
[UIView commitAnimations];

我已经完成了上面的动画,如何找到动画结束,以便我可以在那之后做我的动作.

最佳答案
用这个:

    [UIView animateWithDuration:0.80f animations:^{
    self.view.transform =
    CGAffineTransformMakeTranslation(
                                     self.view.frame.origin.x,
                                     480.0f + (self.view.frame.size.height/2)  // move the whole view offscreen
                                     );
    [self.view setAlpha:0];
    }
    completion:^(BOOL finished){
        // your code
    }];

转载注明原文:iphone – 如何获取动画结束通知 - 代码日志