欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

交互式动画相关类,协议

程序员文章站 2022-03-25 08:52:07
...

UIViewControllerTransitioningDelegate

Getting the Transition Animator Objects方法

- (id<UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented 
                                                                  presentingController:(UIViewController *)presenting 
                                                                      sourceController:(UIViewController *)source;
- (id<UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed;

Getting the Interactive Animator Objects方法

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


UIViewControllerAnimatedTransitioning协议(实现该协议的对象为非交互转场动画)的方法如下:
(void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext;//执行动画

(void)animationEnded:(BOOL)transitionCompleted;//结束动画

- (id<UIViewImplicitlyAnimating>)interruptibleAnimatorForTransition:(id<UIViewControllerContextTransitioning>)transitionContext;//返回被打断动画

UIPercentDrivenInteractiveTransition,交互式动画协议的一个实现类,其中操作动画的几个方法如下:

- (void)updateInteractiveTransition:(CGFloat)percentComplete;//更新交互式动画的完成比例

- (void)pauseInteractiveTransition;//停止动画,当开始交互式动画时,先调用停止当前动画,再调用上面方法
- (void)cancelInteractiveTransition;//取消交互式动画
- (void)finishInteractiveTransition;//结束交互式动画

UIViewControllerInteractiveTransitioning,交互式转场协议,我的理解只提供转场交互方法,不提供专场本身功能。
转场操作相关的方法如下:
- (void)startInteractiveTransition:(id<UIViewControllerContextTransitioning>)transitionContext;//当需要指定可交互的比例时调用,并开始动画。
@property(nonatomic, readonly) BOOL wantsInteractiveStart;//指定动画开始时,是否为交互动画
UIViewControllerContextTransitioning,转场动画Context
1. Accessing the transition objects
  containerView, viewControllerForKey, viewForKey
2. Getting the transition Frame Rectangles
    initialFrameForViewController, finalFrameForViewController
3. Getting the transition behaviors 
    animated, interactive, presentationStyle
4. Reporting the transition progress
    completeTransition:, updateInteractiveTransition,pauseInteractiveTransition,finishInteractiveTransition, cancelInteractiveTransition, transitionWasCancelled。
5.  Getting the Rotation Factor
    targetTransform






- (id<UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented 
                                                                  presentingController:(UIViewController *)presenting 
                                                                      sourceController:(UIViewController *)source;
- (id<UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed;