OC 项目:建议使用2.5 版本,从 GitHub 上可以看到,3.0 版本以上是swift 写的。
Swift 项目:直接使用最新版本。
通过 CocoaPods 集成:
- 在 Podfile 中添加 pod ‘lottie-ios’,’~> 2.5’
- 运行 pod install
示例代码
LOTAnimationView *animation = [LOTAnimationView animationNamed:@"Lottie"];
[self.view addSubview:animation];
[animation playWithCompletion:^(BOOL animationFinished) {
// Do Something
}];