Last active
June 4, 2020 19:10
-
-
Save aheze/f4e0adde2a9adf1a307bf8649c5a72a0 to your computer and use it in GitHub Desktop.
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
| /// the UIImageView that will hold the animation | |
| let imageView = UIImageView() | |
| imageView.frame = CGRect(x: 100, y: 100, width: 150, height: 150) | |
| view.addSubview(imageView) | |
| /// the images that will be animated | |
| /// images are stored in the Resources folder of this playground | |
| let imagesToAnimate = [UIImage(named: "0")!, UIImage(named: "1")!, UIImage(named: "2")!] | |
| imageView.animationImages = imagesToAnimate | |
| imageView.animationDuration = 1 | |
| /// set to -1 for infinite animation | |
| imageView.animationRepeatCount = -1 | |
| imageView.startAnimating() ///stop animation with `imageView.stopAnimating()` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment