iOS App Development Book/Video Series

General Category => FAQs => Topic started by: kjmcneish on September 15, 2015, 04:04:27 AM

Title: How to stop a UIImageView animation on the last image
Post by: kjmcneish on September 15, 2015, 04:04:27 AM
By default, at the end of an animation, UIImageView clears its display. If you want it to display the last image in your animation once the animation is complete, all you have to do is set the UIImageView's image property to the last image in your animation sequence BEFORE setting the animationImages property.

For example:

Code: [Select]
self.imgRobot.image = UIImage(named: "RobotYawnWait156")
self.imgRobot.animationImages = imagesArray

All the best!
Kevin McNeish
Author of Learn to Code in Swift: https://itunes.apple.com/us/book/learn-to-code-in-swift/id942956811?mt=11 (https://itunes.apple.com/us/book/learn-to-code-in-swift/id942956811?mt=11)
Check out our Robot Tic-Tac-Toe app: https://itunes.apple.com/us/app/robot-tic-tac-toe/id990638517?mt=8 (https://itunes.apple.com/us/app/robot-tic-tac-toe/id990638517?mt=8)