IOS: rotate an uiimageview

前端 未结 3 1382
执念已碎
执念已碎 2021-01-05 06:37

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);


        
相关标签:
3条回答
  • 2021-01-05 06:47

    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.

    0 讨论(0)
  • 2021-01-05 06:50

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

    0 讨论(0)
  • 2021-01-05 06:54

    Swift3:

    arrow.transform = CGAffineTransform(rotationAngle: rotation);
    

    where rotation is the angle to rotate in radians.

    0 讨论(0)
提交回复
热议问题