I'm currently trying to add a Lottie Animation to an UIView
, which is located inside of an UIToolbar
. It works fine when the animation is being called in viewDidLoad()
. But calling animationView.play()
inside of the view's bar button item action, won't work.
@IBOutlet var animationSubview: UIView!
let animationView = AnimationView(name: "hamburger")
func setupAnimation() {
animationView.frame = CGRect(x: -33, y: -33, width: 120, height: 120)
animationView.contentMode = .scaleAspectFill
animationSubview.addSubview(animationView)
}
@IBAction func buttonHamburger(_ sender: Any) {
animationView.play()
}
Is there mistake inside of my code or is an UIView
inside of a toolbar just not working?