how do i calculate the angle of rotation for any given object (ie a uiimageview)?
+1
A:
Technically you can't, because the transform can include a skew operation which turns the image into a parallelogram and the rotation angle isn't defined anymore.
Anyway, since the rotation matrix generates
cos(x) sin(x) 0
-sin(x) cos(x) 0
0 0 1
You can recover the angle with
return atan2(transform.b, transform.a);
KennyTM
2010-01-12 19:47:42
thank you :) exactly what i needed
nathanjosiah
2010-01-12 19:49:56
what is transform.b and transform.a? are b and a properties of an transform? have never seen those.
openfrog
2010-02-02 17:44:26
@openfrog: http://developer.apple.com/iphone/library/documentation/GraphicsImaging/Reference/CGAffineTransform/Reference/reference.html#//apple_ref/doc/uid/TP30000946-CH2g-BBCJFFAE
KennyTM
2010-02-02 18:07:31