Last active
March 4, 2021 14:23
-
-
Save jamestapping/2fcd3b03b484923a94d0d57971a5472e to your computer and use it in GitHub Desktop.
Animated UIButton image array creation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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