Swift:围绕左侧旋转imageView

时间:2018-06-30 13:32:37

标签: ios swift

我有这段代码可以使imageView绕其轴(图像中心)旋转:

transform.m34 = 1.0 / -2000.0
self.imageRevealed1.layer.transform = CATransform3DMakeRotation(CGFloat(Double.pi), 0.0, 1.0, 0.0)

但是我需要绕其左侧旋转imageView。怎么做?

1 个答案:

答案 0 :(得分:0)

在设置图层变换之前,您应该修改视图anchorPoint。例如,在您的情况下,anchorPoint应该设置CGPoint(x: 0, y: 0.5),然后设置transform。