问:

一个动画结束后就重新调用这个方法

在点击按钮后,想让这个动画不再执行,如何让它停下来呢?

 

答:

1。添加一个BOOL值,为YES时执行动画,为NO时方法直接return,点击按钮后,设置它为NO就行了

 

2。设置[UIView setAnimationDelegate:nil];

 

3。不用其他额外的变量去控制。

就像performSelector方法可以用 

[NSObject cancelPreviousPerformRequestsWithTarget:(id)];

相关文章:

  • 2022-12-23
  • 2021-04-25
  • 2021-09-25
  • 2021-04-03
  • 2021-07-14
  • 2021-09-04
  • 2022-01-08
  • 2021-11-06
猜你喜欢
  • 2022-12-23
  • 2021-11-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案