How to rotate an object around a arbitrary point?

后端 未结 4 1324
醉酒成梦
醉酒成梦 2020-12-05 08:32

I want to rotate an UILabel around an arbitrary point in a circular manner, not a straight line. This is my code.The final point is perfect but it goes through a straight li

4条回答
  •  执念已碎
    2020-12-05 09:14

    CAKeyframeAnimation is the right tool for this job. Most UIKit animations are between start and end points. The middle points are not considered. CAKeyframeAnimation allows you to define those middle points to provide a non-linear animation. You will have to provide the appropriate bezier path for your animation. You should look at this example and the one's provided in the Apple documentation to see how it works.

提交回复
热议问题