Lottie iOS动画无法在移动设备中运行



我们已经尝试在iOS应用程序中实现Lottie动画。我们添加了一个json文件,该文件在android和web中运行良好,但在iOS中则不然,即标题是不可见的,并且在后台显示了额外的行。以下是用于播放洛蒂动画的代码片段:

animationView = .init(name: "experts") // json file name
animationView?.frame = view.bounds
animationView?.contentMode = .scaleAspectFill
animationView?.loopMode = .playOnce
animationView?.animationSpeed = 0.5
view.addSubview(animationView!)
animationView?.play { (finished) in
// animation is finished
}

Lottie iOS版本-3.3.0Xcode版本-12.4iOS版本-12.5/15.3

试试下面的代码,它运行良好:-

animationView.animation = Animation.named("74683-delivery") //JSON file name
animationView.center = view.center
animationView.frame = view.bounds
animationView.backgroundColor = .white
animationView.contentMode = .scaleAspectFit
animationView.loopMode = .playOnce
animationView.play()
view.addSubview(animationView)

相关内容

最新更新