I have the following code :
#define ANG_TO_RAD(angle) ( angle/180*M_PI)
CGFloat degree = x;
CGAffineTransform transform = CGAffineTransformMakeRotation ( ANG_TO_RAD(degree) );
image.transform = transform;
This rotates the image. However, when I want to rotate it back to the original setting, and call the above function again but with degree=-degree : the image is not rotated exactly to the same position as it was before. There is always some tilt..
I tried to make degree = 180-degree when trying to un-rotate it but no luck
thanks
You’re directly setting the transformation, that is applied to the image, the transformations are not chained automatically, like you seem to be expecting.
To get back to the original you have to apply CGAffineTransformIdentity.
For chaining you use CGAffineTransformConcat e.g.