【发布时间】:2019-12-08 18:18:53
【问题描述】:
我正在尝试在我的 ios 应用程序中使用 Lottie 动画,但我无法让它们工作。我见过人们使用LOTAnimationViews,但我不能导入或使用这个类。我添加了一个包含我的动画的 Animation 文件夹。
视图控制器:
class CardStackViewController: UIViewController, CLLocationManagerDelegate, NetworkManagerDelegate {
...
private let animationView = AnimationView()
...
...
func didFail(with error: Error) {
if let animation = Animation.named("error", subdirectory: "Animations") {
animationView.animation = animation
animationView.loopMode = .loop
view.addSubview(animationView)
animationView.play()
}
print("---DIDFAIL WITH ERROR---", error.localizedDescription, error)
}
...
}
【问题讨论】: