gpt4 book ai didi

ios - lottie 动画在 ios 中为 nil

转载 作者:行者123 更新时间:2023-11-28 19:25:24 27 4
gpt4 key购买 nike

我正在尝试在我的 iOS 应用程序中使用 Lottie 动画,但我无法让它们工作。我见过人们使用 LOTAnimationViews 但我无法导入或使用此类。我添加了一个 Animation 文件夹,其中包含我的动画。

View Controller :

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)
}
...
}

最佳答案

以上

import lottie

并给 View 一个框架

animationView.animation = animation
animationView.frame = ///

关于ios - lottie 动画在 ios 中为 nil,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59238485/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com