ios UIView 动画(onUpdate)
UIView animatWithDuration
有一个用于 completion
的可选参数,但我需要一个用于 update
整个想法是我需要一个在每一帧上运行的块动画片。我想我可以用 NSInterval 来欺骗它,但这看起来很奇怪。
想法?
UIView animatWithDuration
has an optional param for completion
, but I need one for update
The whole idea is I need a block that runs on EVERY frame of animation. I figure I can spoof this with a NSInterval
, but that just seems hoaky.
Thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请改用 CADisplayLink。工作原理与 NSTimer 类似,但每帧精确触发一次,并且与动画完美同步。
设置方法如下:
你的动画代码
然后当动画完成时
Use CADisplayLink instead. Works just like an NSTimer, but fires exactly once every frame and will be perfectly in sync with the animation.
Here's how you set one up:
Your animation code
Then when the animation finishes