Author Topic: How to stop a UIImageView animation on the last image  (Read 5874 times)

kjmcneish

  • Administrator
  • *****
  • Posts: 719
    • View Profile
How to stop a UIImageView animation on the last image
« 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
Check out our Robot Tic-Tac-Toe app: https://itunes.apple.com/us/app/robot-tic-tac-toe/id990638517?mt=8
« Last Edit: November 11, 2015, 12:17:48 PM by kjmcneish »