I am simply trying to spin a UIImageView 360 degrees clockwise using this:
#define DEGREES_TO_RADIANS(angle) (angle / 180.0 * M_PI)
and this
imageView.transform = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(360));
However imageView doesn’t spin at all even those it is being called. Is there something wrong I am doing? I do not want to use CAAnimations so please don’t recommend me to do so.
Thanks!
The problem is that Core Animation will apply animations by finding the most direct route from the current state to the new state. Rotation by 0 degrees is the same as rotation by 360 degrees so the most direct route to your final transform is to do absolutely nothing.
Two steps of 180 degrees would be problematic because there are two equally direct routes from 0 to 180 degrees and Core Animation could pick either. So you probably need to break your animation into three steps. Do the first with a
UIViewAnimationOptionCurveEaseIn, the second withUIViewAnimationOptionCurveLinearand the final withUIViewAnimationOptionCurveEaseOut.