[翻译] CBStoreHouseTransition
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. 完全定制的转场动画
UINavigationControllerpush and pop UINavigationController的push与pop操作UIViewControllerpresentations and dismissals UIViewController 的dismissal与presentations操作
Works for following iOS custom transition types: 支持以下的iOS定制动画类型
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的更多相关文章
- 《Django By Example》第五章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者@ucag注:大家好,我是新来的翻译, ...
- 《Django By Example》第四章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:祝大家新年快乐,这次带来<D ...
- [翻译]开发文档:android Bitmap的高效使用
内容概述 本文内容来自开发文档"Traning > Displaying Bitmaps Efficiently",包括大尺寸Bitmap的高效加载,图片的异步加载和数据缓存 ...
- 【探索】机器指令翻译成 JavaScript
前言 前些时候研究脚本混淆时,打算先学一些「程序流程」相关的概念.为了不因太枯燥而放弃,决定想一个有趣的案例,可以边探索边学. 于是想了一个话题:尝试将机器指令 1:1 翻译 成 JavaScript ...
- 《Django By Example》第三章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:第三章滚烫出炉,大家请不要吐槽文中 ...
- 《Django By Example》第二章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:翻译完第一章后,发现翻译第二章的速 ...
- 《Django By Example》第一章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:本人目前在杭州某家互联网公司工作, ...
- 【翻译】Awesome R资源大全中文版来了,全球最火的R工具包一网打尽,超过300+工具,还在等什么?
0.前言 虽然很早就知道R被微软收购,也很早知道R在统计分析处理方面很强大,开始一直没有行动过...直到 直到12月初在微软技术大会,看到我软的工程师演示R的使用,我就震惊了,然后最近在网上到处了解和 ...
- ASP.NET MVC with Entity Framework and CSS一书翻译系列文章之第一章:创建基本的MVC Web站点
在这一章中,我们将学习如何使用基架快速搭建和运行一个简单的Microsoft ASP.NET MVC Web站点.在我们马上投入学习和编码之前,我们首先了解一些有关ASP.NET MVC和Entity ...
随机推荐
- XML的特殊字符处理
XML中共有5个特殊的字符,分别是:&<>“’.如果配置文件中的注入值包括这些特殊字符,就需要进行特别处理.有两种解决方法:其一,采用本例中的<![CDATA[ ]]> ...
- centos安装postfixadmin
postfixadmin的安装,跟普通网站安装没什么区别 配置好虚拟目录,然后在数据库中创建数据库postfix 修改config.inc.php文件,详细搜索谷歌 访问http://www.你的域名 ...
- HDU 5703 Desert (找规律)
题意:一杯水有n的容量,问有多少种方法可以喝完. 析:找规律,找出前几个就发现规律了,就是2的多少次幂. 代码如下: #include <cstdio> #include <stri ...
- [转]vector iterator not incrementable 的问题
转自:http://blog.csdn.net/kuaile123/article/details/11105115 vector::erase误使用问题: 暂时使用经验: 不能在循环中使用,否则会报 ...
- javaScript 获取主机地址,项目名等
//获取当前网址 var curWwwPath=window.document.location.href; alert(curWwwPath); //http://localhost:8080/ ...
- Hadoop on Mac with IntelliJ IDEA - 6 解决KeyValueTextInputFormat读取时只有key值问题
本文讲述使用KeyValueTextInputFormat在Hadoop 0.x正常工作.Hadoop 1.2.1失效的解决过程. 环境:Mac OS X 10.9.5, IntelliJ IDEA ...
- 王立平--EditPlus激活码
注冊名:Free User 注冊码:6AC8D-784D8-DDZ95-B8W3A-45TFA
- 大话数据结构—平衡二叉树(AVL树)
平衡二叉树(Self-Balancing Binary Search Tree/Height-Balanced Binary Search Tree),是一种二叉排序树,当中每个节点的左子树和右子树的 ...
- CloudStack的VO在调用setRemoved方法抛异常的原因
今天在开发中发现一个问题,本来想对一个VO对象的removed值赋值,然后去update一下这条记录,一个最简单的set方法,但是在调用时直接抛异常了. 1: public void setRemov ...
- C语言统计一个字符串中单词的个数
假定每一个单词用空格隔开. 样例: 输入:how are you! 输出:3 两种方法: 一: #include <stdio.h> #include <string.h> # ...