【发布时间】:2018-09-16 20:49:46
【问题描述】:
有没有办法在自动布局中使用LOTAnimationView(Lottie 框架)?我尝试在我的故事板中将UIView 的类设置为LOTAnimationView,但得到nil IB 出口..
【问题讨论】:
标签: ios swift autolayout uistoryboard lottie
有没有办法在自动布局中使用LOTAnimationView(Lottie 框架)?我尝试在我的故事板中将UIView 的类设置为LOTAnimationView,但得到nil IB 出口..
【问题讨论】:
标签: ios swift autolayout uistoryboard lottie
采取LOTAnimatedControl的出口。
将您的 JSON 文件分配给 LOTAnimationView
lot.animationView.setAnimation(named: "checked_done_")
完整示例:
import UIKit
import Lottie
class ViewController: UIViewController {
@IBOutlet weak var lot: LOTAnimatedControl!
override func viewDidLoad() {
super.viewDidLoad()
lot.animationView.setAnimation(named: "youranimationjsonfile")
lot.animationView.play()
}
}
希望这会对你有所帮助。
【讨论】:
使用Ashish Kakkad 的评论更新最新的 Lottie 版本。
更改类名AnimationView 而不是LOTAnimatedControl,
然后从 Interface Builder 中设置属性 animationName
【讨论】: