I want to apply animation effect by changing two images on button turn by turn. I have applied following code but not able to see animation effect. I have applied IBOutlets properly.
var image1:UIImage = UIImage(named: "img_mic_off")!
var image2:UIImage = UIImage(named: "img_mic_on")!
btnRecord.imageView?.animationImages = [image1,image1]
btnRecord.imageView?.animationDuration = 1.0
btnRecord.imageView!.startAnimating()
Please help me to resolve issue that why it is not working with this given code. Thanks in advance.
Check out what I've done. The images are changing. So I hope this is what you actually needed.
var image1:UIImage = UIImage(named: "img_mic_off")!
var image2:UIImage = UIImage(named: "img_mic_on")!
btn.setImage(image1, forState: UIControlState.Normal)
btn.imageView!.animationImages = [image1, image2]
btn.imageView!.animationDuration = 1.0
btn.imageView!.startAnimating()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With