如何使用修复点旋转UIIMageVIew?

2 iphone

我想在角度上旋转图像.但我想用固定点旋转图像.我如何设置此修复点?

Ed *_*rty 13

设置视图的图层的锚点,它在视图 - 局部坐标中从0到1.也就是说,左上角是0,0,右下角是1,1.

例如,默认是围绕中心旋转:

imageView.layer.anchorPoint = CGPointMake(.5,.5);
Run Code Online (Sandbox Code Playgroud)

如果要围绕原点旋转:

imageView.layer.anchorPoint = CGPointMake(0,0);
Run Code Online (Sandbox Code Playgroud)

或中右边缘:

imageView.layer.anchorPoint = CGPointMake(1,.5);
Run Code Online (Sandbox Code Playgroud)