【发布时间】:2012-12-21 13:55:59
【问题描述】:
我正在设置以下UIView animateWithDuration: 方法,目的是在程序的其他位置设置我的animationOn BOOL 以取消无限循环重复。我的印象是每次动画循环结束时都会调用 completion 块,但事实并非如此。
completion 块是否曾在重复动画中调用?如果没有,有没有其他方法可以从这个方法之外停止这个动画?
- (void) animateFirst: (UIButton *) button
{
button.transform = CGAffineTransformMakeScale(1.1, 1.1);
[UIView animateWithDuration: 0.4
delay: 0.0
options: UIViewAnimationOptionCurveEaseOut | UIViewAnimationOptionAutoreverse | UIViewAnimationOptionRepeat
animations: ^{
button.transform = CGAffineTransformIdentity;
} completion: ^(BOOL finished){
if (!animationOn) {
[UIView setAnimationRepeatCount: 0];
}
}];
}
【问题讨论】:
标签: ios objective-c core-animation uiviewanimation completion-block