Lottie 3.1.x
Every page of my UIPageViewController has a Lottie Animation in a window at the top of the page. I expect all the animations to play when I move to each next page, and back to previous pages.
The animation plays in the first page, but when moving to subsequent pages, or back to the first page, the animations no longer play. It works fine up to v 3.0.6, but stopped working in versions 3.0.7 and 3.1.0 - 3.1.3
var animation: AnimationView?
override func viewDidLoad() {
super.viewDidLoad()
let animation = AnimationView(name: "MyJLottieJson")
animation.loopMode = .loop
animation.contentMode = .scaleAspectFill
animationView.addSubview(animation)
self.animation = animation
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
animation?.play()
}
try
backgroundBehavior = .pauseAndRestore
try
backgroundBehavior = .pauseAndRestore
Yes, setting
animation.backgroundBehavior = .pauseAndRestore
did the trick. Thanks!
Describes the behavior of an AnimationView when the app is moved to the background.
The default is
pausewhich pauses the animation when the application moves to
the background. The completion block is called withfalsefor completed.
How is this in anyway obvious? The documentation needs to be updated so that it doesn't just refer to the app going into the background...
Or instead this is a bug, and that is just an awkward workaround?
Most helpful comment
try