IOS: rotate an uiimageview

2019-02-13 17:14发布

in my app I have an imageview, its name is arrow and I rotate it of 180 degrees in this way:

arrow.transform = CGAffineTransformMakeRotation(M_PI);

it work fine, but now I want that this imageview return in the original position; what's the value taht I should set to obtain it?

3条回答
我想做一个坏孩纸
2楼-- · 2019-02-13 17:59

Try setting the transform property back to the identity matrix. i.e. CGAffineTransformIdentity

查看更多
对你真心纯属浪费
3楼-- · 2019-02-13 17:59

Swift3:

arrow.transform = CGAffineTransform(rotationAngle: rotation);

where rotation is the angle to rotate in radians.

查看更多
干净又极端
4楼-- · 2019-02-13 18:01

To make it return to it's original position, just do this:

arrow.transform = CGAffineTransformMakeRotation(0);

In degrees, 0 radians is 0 degrees, so it should return to its original position.

查看更多
登录 后发表回答