2011-05-01 105 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及更高版本不鼓励在此方法中使用此方法 。您应该使用基于块的动画方法 来指定您的动画,而不是使用 。