从特定侧旋转 UIImageView - iOS



我想从特定侧(例如右侧)旋转图像(UIImageView)。

我知道通过:-

float degrees = 20; //the value in degrees
imageView.transform = CGAffineTransformMakeRotation(degrees * M_PI/180);

但它从中心旋转。

我想从某一特定侧旋转我的 UIImageView(即左侧将在其位置,右侧将更改其位置)。

提前谢谢。

尝试使用anchorPoint属性。

imageView.layer.anchorPoint = CGPointMake(0, 0);//Top left angle
float degrees = 20; //the value in degrees
imageView.transform = CGAffineTransformMakeRotation(degrees * M_PI/180);

不要忘记添加QuartzCore框架。

从中心旋转并将UIImageView移动到您想要的位置。结果将与从右边缘旋转相同。

最新更新