[英]Using LOTAnimationView with Auto Layout in Storyboard
有没有办法使用LOTAnimationView
(Lottie框架)与自动布局? 我尝试在我的故事板LOTAnimationView
UIView
的类设置为LOTAnimationView
,但是获得了nil
IB outlet ..
拿一个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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.