转场动画再次学习

demo链接:http://pan.baidu.com/s/1kVvn1Uf

主要理清转场动画,和转场交互动画的使用

present/dissmiss

需要:

self.transitioningDelegate = self;

<UIViewControllerTransitioningDelegate>

#pragma mark - 定制转场动画 (Present 与 Dismiss动画代理)
- (id<UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented
                                                                  presentingController:(UIViewController *)presenting
                                                                      sourceController:(UIViewController *)source

交互代理

- (id<UIViewControllerInteractiveTransitioning>)interactionControllerForPresentation:(id<UIViewControllerAnimatedTransitioning>)animator

push/pop

需要

<UINavigationControllerDelegate>

self.navigationController.delegate = self;

- (id <UIViewControllerAnimatedTransitioning>)navigationController:(UINavigationController *)navigationController
                                   animationControllerForOperation:(UINavigationControllerOperation)operation
                                                fromViewController:(UIViewController *)fromVC
                                                  toViewController:(UIViewController *)toVC

交互代理

- (id <UIViewControllerInteractiveTransitioning>)navigationController:(UINavigationController *)navigationController
                          interactionControllerForAnimationController:(id <UIViewControllerAnimatedTransitioning>) animationController 

然后你只需要在动画转场里面做动画就行了,添加手势百分比会根据动画的百分比播放动画

简单来说自定义转场动画除了比较麻烦的步骤,剩下的就是--添加动画,控制手势方向和比率

原文地址:https://www.cnblogs.com/hxwj/p/5320305.html