2011-05-01 117 views
1

我正在使用此代碼來製作動畫。我的問題是如何停止動畫?不要告訴我改變重複次數。我想動畫工作,直到我說停止。有沒有一種方法可以用來實現這一點?如何停止動畫?

[UIView beginAnimations:nil context:nil]; 
[UIView setAnimationDuration:1.0]; 
[UIView setAnimationRepeatAutoreverses:YES]; 
[UIView setAnimationRepeatCount:INFINITY]; 
[[menuViewOne loadBut] setFrame:CGRectMake(230, 35, 150, 25)]; 
[UIView commitAnimations]; 

回答

0

您可以使用塊啓動停止動畫。文檔不建議使用動畫。

來自文檔。

iOS 4.0及更高版本不鼓勵在此方法中使用此方法 。您應該使用基於塊的動畫方法 來指定您的動畫,而不是使用 。