How can I callback as a CABasicAnimation is animating?

眉间皱痕 提交于 2019-12-20 06:04:45

问题


I have an animation I'm using to snap a rotatable UIView to a circular grid. As the view animates, I need to update another view based on the rotating views position.

How can I go about getting the position of the rotating view as it animates into position?


回答1:


When animation starts you can start a function that will be polling current view position using a timer (I suppose you will need to get presentationLayer from view's layer and get position values from it).

There's no callbacks for CAAnimation other than animationDidStart and animationDidStop so it seems that's the solution (if I'm not mistaken it was also mentioned so in one of WWDC videos).



来源:https://stackoverflow.com/questions/3493992/how-can-i-callback-as-a-cabasicanimation-is-animating

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!