I'm creating a custom view with 2 image views, and I want to be able to animate from one to another, here's my code:
class FlashCard: UIView {
required init?(coder: NSCoder) {
super.init(coder: coder)
let firstImageView = UIImageView(frame: self.frame)
firstImageView.image = UIImage(named: "Lightning")
addSubview(firstImageView)
let secondImageView = UIImageView(frame: frame)
secondImageView.image = UIImage(named: "Tifa")
addSubview(secondImageView)
secondImageView.isHidden = true
}
func showBack() {
UIView.transition(from: firstImageView, to: secondImageView, duration: 1.0, options: UIViewAnimationOptions.transitionCrossDissolve, completion: nil)
}
}
But in my showBack
function, I got the error: use of unresolved identifier.
How do I properly access firstImageView
and secondImageView
?