CBStoreHouseTransition

What is it?

A custom transition inspired by Storehouse iOS app, also support pop gesture.

一个自定义转场效果,灵感来自于Storehouse的app,支持pop的手势.

Features

  • One class file includes both pop and push transition and pop gesture. 一个类文件包含了pop与push动画效果以及pop手势
  • Fully customizable transition animation. 完全定制的转场动画
  • Works for following iOS custom transition types:  支持以下的iOS定制动画类型

    • UINavigationControllerpush and pop  UINavigationController的push与pop操作
    • UIViewController presentations and dismissals  UIViewController 的dismissal与presentations操作

Which files are needed?

You only need to include CBStoreHouseTransition (.h .m) in your project, it contains both animator and interactive class.

CocoaPods support is coming very soon!

你只需要将CBStoreHouseTransition(.h .m)引入到你的项目当中,他们已经包含了动画器以及交互的实现.

而且很快就会支持CocoaPods!

How to use it

For animator object you need to set proper AnimationType to matchUINavigationControllerOperation object.

For interactive transition you need to attach current view controller using:

对于动画器对象,你需要设置AnimationType到matchUINavigationControllerOperation对象当中.

对于交互式转场动画,你需要获取到将当前控制器的view

- (void)attachToViewController:(UIViewController *)viewController;

A edge pan gesture will be added on the view controller's root view to handle the pop gesture and drive the interactive transition.

Then just return the proper animatior or interactive object in related delegate method, following is a example using CBStoreHouseTransition for UINavigationController.

For more information about iOS custom transition, please refer to WWDC 2013 Custom Transitions Using View Controllers video.

屏幕边缘的手势被添加到了控制器的root的view当中,用来处理以及驱动动态转场交互效果.

然后,返回合适的动画器对象或者在代理方法中返回交互对象,以下的例子就是用CBStoreHouseTransition来进行UINavigationController转场动画的.

- (void)viewDidLoad
{
...
self.animator = [[CBStoreHouseTransitionAnimator alloc] init];
...
} - (void)viewDidAppear:(BOOL)animated
{
...
self.navigationController.delegate = self;
self.interactiveTransition = [[CBStoreHouseTransitionInteractiveTransition alloc] init];
[self.interactiveTransition attachToViewController:self];
...
} -(id<UIViewControllerAnimatedTransitioning>)navigationController:(UINavigationController *)navigationController
animationControllerForOperation:(UINavigationControllerOperation)operation
fromViewController:(UIViewController *)fromVC
toViewController:(UIViewController *)toVC
{
switch (operation) {
case UINavigationControllerOperationPush:
//we don't need interactive transition for push
self.interactiveTransition = nil;
self.animator.type = AnimationTypePush;
return self.animator;
case UINavigationControllerOperationPop:
self.animator.type = AnimationTypePop;
return self.animator;
default:
return nil;
}
} - (id<UIViewControllerInteractiveTransitioning>)navigationController:(UINavigationController *)navigationController
interactionControllerForAnimationController:(id<UIViewControllerAnimatedTransitioning>)animationController
{
return self.interactiveTransition;
}

Since we don't need interactive for push transition or when user specificity taps back button, you need to set self.interactive to nil.

You can customize following properties to change the animation behavior:

一旦我们不想用动态交互来push或者想用返回按钮那种简单的方式,你需要设置self.interactive为nil.

你可以定制如下的一些参数来改变动画的效果:

@property (nonatomic) CGFloat duration;
@property (nonatomic) CGFloat rotateAngle;
@property (nonatomic) CGFloat relativeDelayLeftView;
@property (nonatomic) CGFloat relativeDelayRightView;
@property (nonatomic) CGFloat percentageAdjustFactor;

[翻译] CBStoreHouseTransition的更多相关文章

  1. 《Django By Example》第五章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者@ucag注:大家好,我是新来的翻译, ...

  2. 《Django By Example》第四章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:祝大家新年快乐,这次带来<D ...

  3. [翻译]开发文档:android Bitmap的高效使用

    内容概述 本文内容来自开发文档"Traning > Displaying Bitmaps Efficiently",包括大尺寸Bitmap的高效加载,图片的异步加载和数据缓存 ...

  4. 【探索】机器指令翻译成 JavaScript

    前言 前些时候研究脚本混淆时,打算先学一些「程序流程」相关的概念.为了不因太枯燥而放弃,决定想一个有趣的案例,可以边探索边学. 于是想了一个话题:尝试将机器指令 1:1 翻译 成 JavaScript ...

  5. 《Django By Example》第三章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:第三章滚烫出炉,大家请不要吐槽文中 ...

  6. 《Django By Example》第二章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:翻译完第一章后,发现翻译第二章的速 ...

  7. 《Django By Example》第一章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:本人目前在杭州某家互联网公司工作, ...

  8. 【翻译】Awesome R资源大全中文版来了,全球最火的R工具包一网打尽,超过300+工具,还在等什么?

    0.前言 虽然很早就知道R被微软收购,也很早知道R在统计分析处理方面很强大,开始一直没有行动过...直到 直到12月初在微软技术大会,看到我软的工程师演示R的使用,我就震惊了,然后最近在网上到处了解和 ...

  9. ASP.NET MVC with Entity Framework and CSS一书翻译系列文章之第一章:创建基本的MVC Web站点

    在这一章中,我们将学习如何使用基架快速搭建和运行一个简单的Microsoft ASP.NET MVC Web站点.在我们马上投入学习和编码之前,我们首先了解一些有关ASP.NET MVC和Entity ...

随机推荐

  1. 创建Android Virtual Device

    参考http://book.51cto.com/art/201302/380026.htm Linux版的Android SDK没有提供可视化的AVD Manager管理工具,创建AVD可以使用and ...

  2. OC:基础学习

    OC面向对象的编程语言思想 类与对象.继承与实例化.属性点语法.内存管理.字符串.可见度. 类是一组具有相同特征和行为的事物的抽象 OC的与C相比所具有的新的特点: 定义新的类.类的实例和方法.方法的 ...

  3. [转]C/C++中的memset

    http://blog.csdn.net/songuooo/article/details/7819790 1. 需要的头文件 C中为<memory.h> 或 <string.h&g ...

  4. linux 安装Apache----tar.gz文件安装方式(零环境安装)

    一.下载apache源代码 1.下载地址:http://httpd.apache.org/download.cgi  找稳定的最新的版本(Stable Release) 得到文件 httpd-2.4. ...

  5. wpf随笔

    因项目需要查找wpf.DataGrid的Binding方法, 由于其属于Dev框架体系内,偏向于winform并无Binding 1.且线程外更改UI控件还需要委托或者action,而Wpf控件仅需要 ...

  6. Spket在Eclipse/MyEclipse下的安装和配置(图文教程)

    一.安装Spket 第一种方法:网上更新方式 1.插件首页:http://www.spket.com2.插件名称:Spket IDE3.更新连接(Update Site):http://www.spk ...

  7. MFC 学习 之 工具栏的添加(一)

    最终实现的效果图: 步骤一:接下来在资源视图中添加一个ToolBar工具栏(具体怎么添加在这儿就不详细讲解了!)添加后的ToolBar以及工具栏中每个按钮 所命名的ID如下:(可以自定义,只要不重名就 ...

  8. Qt中的 Size Hints 和 Size Policies

    sizeHint 这个属性所保存的 QSize 类型的值是一个被推荐给窗口或其它组件(为了方便下面统称为widget)的尺寸,也就是说一个 widget 该有多大,它的一个参考来源就是这个 sizeH ...

  9. CSS实现标题右侧“更多”

    HTML < h2>< a h ref="#" >标题< /a> < span>更多…< /span> < /h2 ...

  10. BP神经网络算法学习

    BP(Back Propagation)网络是1986年由Rumelhart和McCelland为首的科学家小组提出,是一种按误差逆传播算法训练的多层前馈网络,是眼下应用最广泛的神经网络模型之中的一个 ...