How can I callback as a CABasicAnimation is animat

2019-03-05 15:52发布

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条回答
淡お忘
2楼-- · 2019-03-05 16:19

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).

查看更多
登录 后发表回答