文章来源:淘论文网   发布者: 毕业设计   浏览量: 31



还可以点击去查询以下关键词:
[KYPushT]    [毕业]    [ransition]    [KYPushT毕业ransition]   

项目介绍:

KYPushTransition

https://github.com/KittenYang/KYPushTransition

一个3D翻转的转场动画,可以手势百分比控制。

Usage

以下代码全在第一个视图控制器中实现:

进入第一个控制器。在跳转之前,开题报告,设置后一个控制器的代理,比如我用Segue的话,开题报告,就在-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender里设置后一个控制器的代理为前一个控制器,并且让后一个控制器实现手势返回的交互:

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{ SecondViewController *secVC = (SecondViewController *)segue.destinationViewController; secVC.transitioningDelegate = self; popInteractive = [KYPopInteractiveTransition new]; [popInteractive addPopGesture:secVC]; }

然后分两种情况:

1)如果只是一个VC present 到另一个 VC,那么你需要实现UIViewControllerTransitioningDelegate中的两个协议,分别对应present和dismiss,返回对应的动画:- (id <UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source{ KYPushTransition *flip = [KYPushTransition new]; return flip; } - (id <UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed{ KYPopTransition *flip = [KYPopTransition new]; return flip; }

然后是手势交互的方法,比较常用的情况是返回上一个VC利用手势,所以这里只实现了dismiss的方法:

- (id <UIViewControllerInteractiveTransitioning>)interactionControllerForDismissal:(id <UIViewControllerAnimatedTransitioning>)animator{ return popInteractive.interacting ? popInteractive : nil; }2)如果你是用UINavigationController控制两个VC,那么需要实现UINavigationControllerDelegate中的:- (id <UIViewControllerAnimatedTransitioning>)navigationController:(UINavigationController *)navigationController animationControllerForOperation:(UINavigationControllerOperation)operation fromViewController:(UIViewController *)fromVC toViewController:(UIViewController *)toVC{ if (operation == UINavigationControllerOperationPush) { KYPushTransition *flip = [KYPushTransition new]; return flip; }else if (operation == UINavigationControllerOperationPop){ KYPopTransition *flip = [KYPopTransition new]; return flip; }else{ return nil; } }

UINaviagtionController控制VC的情况下,UINavigationControllerDelegate也有相应的手势交互的协议方法:

- (id <UIViewControllerInteractiveTransitioning>)navigationController:(UINavigationController *)navigationController interactionControllerForAnimationController:(id <UIViewControllerAnimatedTransitioning>) animationController{ return popInteractive.interacting ? popInteractive : nil;

点击博客介绍阅读详细实现细节


这里还有:


还可以点击去查询:
[KYPushT]    [毕业]    [ransition]    [KYPushT毕业ransition]   

请扫码加微信 微信号:sj52abcd


下载地址: http://www.taolw.com/down/8417.docx
  • 上一篇:一个可高度自定定制义的alertController
  • 下一篇:SCTable毕业设计ViewCell