如何在一个选定的点旋转 CALayer。
最佳答案
CATransform3D transform = CATransform3DIdentity;
transform = CATransform3DTranslate(transform, rotationPoint.x-center.x, rotationPoint.y-center.y, 0.0);
transform = CATransform3DRotate(transform, rotationAngle, 0.0, 0.0, -1.0);
transform = CATransform3DTranslate(transform, center.x-rotationPoint.x, center.y-rotationPoint.y, 0.0);
其中center
是图层的中心,rotationAngle
以弧度为单位(正值是逆时针),rotationPoint
是围绕它旋转的点。你想要旋转。 center
和 rotationPoint
位于包含 View 的坐标空间中。
关于iphone - 如何在某一点旋转 CALayer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3926923/