Recipe: Image View Animations
In addition to displaying static pictures, the UIImageView
class supports built-in animation sequences. After loading an array of image cels, you can tell instances to animate them. Recipe 4-12 shows how.
Start by creating an array populated by individual images loaded from files and assign this array to the UIImageView
instance’s animationImages
property. Set animationDuration
to the total loop time for displaying all the images in the array. Finally, begin animating by sending the startAnimating
message. (There’s a matching stopAnimating
method available for use as well.)
After you add the animating image view to your interface, you can place it into a single location, or you can animate it just as you would animate ...
Get The Core iOS Developer’s Cookbook, Fifth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.