lottie-ios 简单应用

pod 'lottie-ios', '~>2.1.0'
#import <Lottie/Lottie.h>
 LOTAnimationView *giftAnimationView = [LOTAnimationView animationNamed:@"16221-cyper1"];
  giftAnimationView.frame = CGRectMake(10, 240, 350, 250);
    [self.view addSubview:giftAnimationView];
    giftAnimationView.backgroundColor = UIColor.cyanColor;
    
    __weak LOTAnimationView *weakGiftAnimationView = giftAnimationView;
    
    [giftAnimationView playWithCompletion:^(BOOL animationFinished) {
        
        [UIView animateWithDuration:0.5 animations:^{
            weakGiftAnimationView.alpha = 0.0;
        } completion:^(BOOL finished) {
            [weakGiftAnimationView removeFromSuperview];
        }];

        button.enabled = YES;
    }];

附json文件下载地址
666

推荐阅读更多精彩内容