Hello. I am trying to show an image for a short time, in an animated way, and hidden again. This is the function:
@IBOutlet var statusField: UIImageView!
@IBAction func debugbutton(_ sender: UIButton) {
showIcon()
}
override func viewDidLoad() {
super.viewDidLoad()
statusField.isHidden = true
func showIcon() {
statusField.isHidden = false
UIView.animate(withDuration: 1, delay: 0.5, options: UIView.AnimationOptions.transitionFlipFromTop, animations: {
self.statusField.alpha = 0
}, completion: { finished in
self.statusField.isHidden = true
})
}
When I run the function for the first time it works fine but then it stops doing it. The icon is no longer displayed. Any advice on what's going on? Thanks!