阻止 UIImageView 动画,或者“当动画未完成时,旋转”
我目前正在通过 4 个 UIImageViews 对许多图像进行动画处理,并且在这方面一切都很好。动画按预期完成,我假设它们在自己的 NSThread 内运行,因为尽管有动画,执行仍在继续。当然,这是良好且预期的行为,因为我绝对不希望我的整个应用程序在动画完成之前停止。
但是,我需要启动一个需要依赖于动画是否正在运行的方法。
据我了解,以下代码很糟糕,因为在主线程内引入循环和其他延迟会导致不稳定。
while([self.fooImgView isAnimating])
;
此代码有效地停止了整个应用程序的执行。我需要找到一种方法来“旋转”直到动画完成,而不需要楔入应用程序。
对此的任何建议将不胜感激。
谢谢!
SC。
I'm currently animating many images via 4 UIImageViews, and all is well on that front. The animations complete as expected, and I am assuming that they run inside their own NSThread, as execution continues despite the animation. Of course, this is good and expected behaviour, as I definitely wouldn't want my whole app to halt until the animation finishes.
However, I need to kick off a method which needs to depend on whether the animation is running or not.
The following code is bad as I understand, as introducing loops and other delays inside the main thread causes instability.
while([self.fooImgView isAnimating])
;
This code effectively halts execution of the whole app. I need to find a way to "spin" until the animation completes, without wedging the app.
Any advice on this would be greatly appreciated.
Thanks!
sc.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用块动画像这个,你可以使用完成块来调用一些委托或执行你的方法
If you use block animations like this one, you can use the completion block to call some delegate or execute your method