我正在设置以下UIView animateWithDuration:
方法,目的是在程序中的其他位置设置我的animationOn
BOOL以取消该无限循环重复。我的印象是,每当动画的一个循环结束时,completion
块就会被调用,但看起来并不是这样。使用BOOL /完成块停止自动反向/无限重复UIView动画
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];
}
}];
}
这没有用,恐怕。应用变换后的动画仍然在进行。 (我将'.transform'设置为'CGAffineTransformMakeScale(1.0,1.0)')。 – Luke
我发现了其他可能工作的东西。我更新了我的答案。你可以试试吗? –
哦,你自己想出来:)谢谢你接受我的答案无论如何 –