我在我的应用程序中使用 UIView
动画:
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1];
//do some animation
[UIView commitAnimations];
现在,动画可能需要几秒钟才能完成。那么,有没有办法知道动画何时结束呢?
最佳答案
使用苹果提供的最新的基于 block 的动画方法:
[UIView animateWithDuration:0.5
delay:0.0
options:UIViewAnimationOptionBeginFromCurrentState
animations:^{
//animation block
}
completion:^(BOOL finished){//this block starts only when
//the animation in the upper block ends
//so you know when exactly the animation ends
}];
您使用的方法即将被弃用...
关于iphone - UIView动画结束,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7386186/