Author Topic: How to execute code after a UIImageView animation completes--without timers!  (Read 5233 times)


  • Administrator
  • *****
  • Posts: 719
    • View Profile
I found a great little extension to UIImageView that allows you to specify a block to be executed after the UIImageView animation is complete. Unlike other solutions that use a timer (bad idea). It uses CAKeyframeAnimation instead, with its animationDidStop method, which is far more reliable:

It's written in Objective-C, so you Swifters just need to add it to your project and then import it in your bridging header file:

Code: [Select]
#import "UIImageView+AnimationCompletion.h"
All the best!
Kevin McNeish
Author of Learn to Code in Swift:
« Last Edit: September 15, 2015, 03:54:37 AM by kjmcneish »