我正在設置以下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
我發現了其他可能工作的東西。我更新了我的答案。你可以試試嗎? –
哦,你自己想出來:)謝謝你接受我的答案無論如何 –