Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Create a rotation affine transform and use the animation methods
of UIView to animate the
rotation.
I highly recommend that you read Recipe 15.13 before proceeding with this section of the book.
In order to rotate a view while animating it, you must apply a rotation transformation to it while in an animation block (see Recipe 15.11). Let’s have a look at some sample code that will make this clearer. Let’s say we have an image named Xcode.png (see Figure 15-14), and we want to display it in the center of the screen. After the image is displayed, we want to rotate it 90 degrees over a five-second time period and then rotate it back to its original orientation. So when the view appears on the screen, let’s rotate the image view 90 degrees clockwise: