Skip to content

Instantly share code, notes, and snippets.

@jamestapping
Last active March 4, 2021 14:23
Show Gist options
  • Save jamestapping/2fcd3b03b484923a94d0d57971a5472e to your computer and use it in GitHub Desktop.
Save jamestapping/2fcd3b03b484923a94d0d57971a5472e to your computer and use it in GitHub Desktop.
Animated UIButton image array creation
func setUpAnimatedFramesButton() {
var imagesListArray :[UIImage] = []
for position in 0...27
{
let strImageName : String = "icons8-cancel-\(position)"
let image = UIImage(named:strImageName)
imagesListArray.append(image!)
}
animatedFramesButton.setImage(imagesListArray[0], for: .normal)
animatedFramesButton.imageView?.animationImages = imagesListArray
animatedFramesButton.imageView?.animationDuration = 1.0
animatedFramesButton.imageView?.startAnimating()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment