ios4 - XCode rotate uibutton clockwise -
i want rotate uibutton @ 180 degrees clockwise. rotate counterclockwise.
this how tried:
cgcontextref context = uigraphicsgetcurrentcontext(); [uiview beginanimations:nil context:context]; [uiview setanimationcurve:uiviewanimationcurveeaseinout]; [uiview setanimationduration:0.3]; mybutton.transform = cgaffinetransformrotate( mybutton.transform, m_pi); [uiview commitanimations];
also this:
mybutton.transform = cgaffinetransformrotate( mybutton.transform, - m_pi);
what doing wrong?
i've had similar experience, , best guess following:
the rotation transform translates net result, meaning absolute rotation. since rotating -pi , +pi results in same net effect (both 180 degrees), animation ends choosing default direction; seems counterclockwise on ios.
by setting value more negative -m_pi, @kishorebjv mentioned, shortest rotation path through positive direction (switching animation clockwise). can see effect using m_pi+0.01 or m_pi-0.01. both positive numbers, result in different directions.
more verbose explanation: value: m_pi+0.01 direction: counterclockwise reasoning: this translates rotation of ~180.6, shortest rotation negative 179.4 degrees.
value: m_pi-0.01 direction: clockwise reasoning: this translates rotation of ~179.4, shortest rotation positive 179.4 degrees. , going value given kishorebjv value: -3.141593 direction: clockwise reasoning: value past -180 degrees, recalling pi 3.1415926 ....so shortest rotation positive 179 degrees
Comments
Post a Comment