iOS接入 Lottie
Posted hangman
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了iOS接入 Lottie相关的知识,希望对你有一定的参考价值。
oc
用pod
pod ‘lottie-ios‘, ‘~> 2.5.2‘
加载动画
@property (nonatomic, strong) LOTAnimationView * lottielogo;
self.lottielogo = [LOTAnimationView animationNamed:@"LottieLogo1"];
self.lottielogo.contentMode = UIViewContentModeScaleAspectFill;
self.lottielogo.frame = CGRectMake(0,0, self.view.frame.size.width, self.view.frame.size.height*1/3);
[self.view addSubview:self.lottielogo];
-(void)viewWillAppear:(BOOL)animated
[super viewWillAppear:animated];
[self.lottielogo play];
-(void)viewDidDisappear:(BOOL)animated
[super viewDidDisappear:animated];
[self.lottielogo pause];
<UIViewControllerTransitioningDelegate>代理
HySecondViewController * vc = [HySecondViewController new];
vc.transitioningDelegate = self;
[self presentViewController:vc animated:YES completion:nil];
#pragma mark == View ControllerView dele ==
-(id<UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source
LOTAnimationTransitionController *animationController = [[LOTAnimationTransitionController alloc] initWithAnimationNamed:@"vcTransition1"
fromLayerNamed:@"outLayer"
toLayerNamed:@"inLayer"
applyAnimationTransform:NO];
return animationController;
-(id<UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed
LOTAnimationTransitionController *animationController = [[LOTAnimationTransitionController alloc] initWithAnimationNamed:@"vcTransition2"
fromLayerNamed:@"outLayer"
toLayerNamed:@"inLayer"
applyAnimationTransform:NO];
return animationController;
以上是关于iOS接入 Lottie的主要内容,如果未能解决你的问题,请参考以下文章