iOS页面切换动画实现方式。
iOS页面切换动画实现方式。
1.使用UIView animateWithDuration:animations:completion方法
Java代码
- [UIView animateWithDuration:0.2f animations:^{
- detail.view.frame = CGRectMake(0, 0, detail.view.frame.size.width, detail.view.frame.size.height);
- } completion:^(BOOL finished) {
- UITableViewCell *cell = [articleTable cellForRowAtIndexPath:idx];
- cell.backgroundColor = [UIColor clearColor];
- }];
复制代码
2.使用UIView beginAnimations:context和UIView commitAnimations方法
Java代码
- [UIView beginAnimations:nil context: nil];
- [UIView setAnimationDuration:1.0];
- [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];//指定动画曲线
- [UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.view cache:YES];//指定动画方式为卷帘向下,类似的动画切换方式有CurlUp、FlipFromLeft、FlipFromRight,对应Apple Developer Documents中的枚举结构如下
- //UIViewAnimationTransition
- //Specifies a transition to apply to a view in an animation block.
- //typedef enum {
- // UIViewAnimationTransitionNone,
- // UIViewAnimationTransitionFlipFromLeft,
- // UIViewAnimationTransitionFlipFromRight,
- // UIViewAnimationTransitionCurlUp,
- // UIViewAnimationTransitionCurlDown,
- //} UIViewAnimationTransition;
- //要动画改变的属性
- self.view.alpha = 0.0;//动画改变透明度
- self.view.frame = CGRectMake(10, 10, 50, 50);//动画将视图改变到指定位置指定大小
- [self.view exchangeSubviewAtIndex:1 withSubviewAtIndex:0];
- [UIView commitAnimations];//提交动画
复制代码
3.使用QuartzCore框架中的CATransition
Java代码
- CATransition *animation = [CATransition animation];
- animation.delegate = self;
- animation.duration = kDuration;
- animation.timingFunction = UIViewAnimationCurveEaseInOut;//动画的开始与结束的快慢
- animation.type = kCATransitionFade;//指定动画方式为Fade渐隐消去、类似还有kCATransitionPush、kCATransitionReveal、kCATransitionMoveIn、@"cube"、@"suckEffect"、@"oglFlip"、@"rippleEffect"、@"pageCurl"、@"pageUnCurl"、@"cameraIrisHollowOpen"、@"cameraIrisHollowClose"等,
- //pageCurl 向上翻一页
- //pageUnCurl 向下翻一页
- //rippleEffect 滴水效果
- //suckEffect 收缩效果,如一块布被抽走
- //cube 立方体效果
- //oglFlip 上下翻转效果
- //cameraIrisHollowOpen 相机打开效果
- //cameraIrisHollowClose 相机关闭效果
- Apple Developer Documents中介绍如下
- //Common Transition Types
- //These constants specify the transition types that can be used with the type property.
- //NSString * const kCATransitionFade;
- //NSString * const kCATransitionMoveIn;
- //NSString * const kCATransitionPush;
- //NSString * const kCATransitionReveal;
- animation.subtype = kCATransitionFromLeft;//指定动画进行方向从左边开始,类似还有kCATransitionFromBottom、kCATransitionFromRight、kCATransitionFromTop,Apple Developer Documents中介绍如下
- //Common Transition Subtypes
- //These constants specify the direction of motion-based transitions. They are used //with the subtype property.
- //NSString * const kCATransitionFromRight;
- //NSString * const kCATransitionFromLeft;
- //NSString * const kCATransitionFromTop;
- //NSString * const kCATransitionFromBottom;
- [self.view exchangeSubviewAtIndex:1 withSubviewAtIndex:0];
- [[self.view layer] addAnimation:animation forKey:@"animation"];
复制代码
原文链接:http://www.apkbus.com/android-131034-1-1.html
iOS页面切换动画实现方式。的更多相关文章
- (原)android中的动画(三)之动画监听&页面切换动画
1.动画也可以设置监听事件,例如在动画结束时需要执行某操作 把要执行的代码写在onAnimationEnd()回调方法中即可: anim.setAnimationListener(new Animat ...
- iOS页面间传值的方式(NSUserDefault/Delegate/NSNotification/Block/单例)
iOS页面间传值的方式(NSUserDefault/Delegate/NSNotification/Block/单例) 实现了以下iOS页面间传值:1.委托delegate方式:2.通知notific ...
- 【转】iOS页面间传值的方式(Delegate/NSNotification/Block/NSUserDefault/单例)-- 不错
原文网址:http://www.cnblogs.com/JuneWang/p/3850859.html iOS页面间传值的方式(NSUserDefault/Delegate/NSNotificatio ...
- iOS页面间传值的方式 (Delegate/NSNotification/Block/NSUserDefault/单例)
iOS页面间传值的方式(Delegate/NSNotification/Block/NSUserDefault/单例) iOS页面间传值的方式(NSUserDefault/Delegate/NSN ...
- QtQuick多页面切换、多页面切换动画、多个qml文件数据交互
一.QtQuick多页面切换方法 (1)“隐藏法” 前一个视图visible设为false或者透明度opacity设为0,相当于“隐藏”了,实际还存在: 要显示的视图visible设为true或者透明 ...
- Android5.0之后的页面切换动画
Android5.0之后给我们开发者剩了好多的事情,为什么这么说呢?还记得刚开始的时候,Android里面的所有的动画都要我们开发者自己来写,现在不需要了,因为5.0之后自带了好多的动画,比如:按钮点 ...
- iOS页面间传值的方式(Delegate/NSNotification/Block/NSUserDefault/单例)
iOS页面间传值实现方法:1.通过设置属性,实现页面间传值:2.委托delegate方式:3.通知notification方式:4.block方式:5.UserDefault或者文件方式:6.单例模式 ...
- PresentViewController切换界面(一些系统自带的页面切换动画)
视图切换,没有NavigationController的情况下,一般会使用presentViewController来切换视图并携带切换时的动画, 其中切换方法如下: – presentViewCon ...
- Windows Phone使用sliverlight toolkit实现页面切换动画效果
使用应用时,好多app在页面切换的时候都有一个动画效果,感觉很炫,也大大增加了用户体验,怎么实现呢? 界面的切换,可以用Windows Phone Toolkit中的TransitionService ...
随机推荐
- IdentityServer4 中文文档
一.介绍 特性一览 整体介绍 术语的解释 支持的规范 包和构建说明 二.快速入门 设置和概述 #1 使用客户端证书控制API访问 #2 使用密码认证方式控制API访问 #3 使用OpenId Conn ...
- Android基础_Service
一.service的用途 1.1 一种是执行长时间运行的耗时操做 1.如网络下载.音乐播放2.文件系统监控等 1.2 另一种是负责组件间的交互 1.将某些功能以Service组件形式封装,然后提供给其 ...
- 副本机制与副本同步------《Designing Data-Intensive Applications》读书笔记6
进入到第五章了,来到了分布式系统之中最核心与复杂的内容:副本与一致性.通常分布式系统会通过网络连接的多台机器上保存相同数据的副本,所以在本篇之中,我们来展开看看如何去管理和维护这些副本,以及这个过程之 ...
- 读书笔记-JavaScript面向对象编程(三)
第7章 浏览器环境 7.1 在HTML页面中引入JavaScript代码 7.2概述BOM与DOM(页面以外事物对象和当前页面对象) 7.3 BOM 7.3.1 window对象再探(所以JavaSc ...
- CSS 换行问题white-space属性 window对象和global对象
white-space: nowrap禁止换行 1.word-wrap:break-word; 内容将在边界内换行,仅用于块对象,内联对象要用的话,必须要设定height.width或display: ...
- 【BZOJ】初级水题列表——献给那些想要进军BZOJ的OIers(自用,怕荒废了最后的六月考试月,刷刷水题,水水更健康)
BZOJ初级水题列表——献给那些想要进军BZOJ的OIers 代码长度解释一切! 注:以下代码描述均为C++ RunID User Problem Result Memory Time Code_Le ...
- [bzoj4098] [Usaco2015 Open]Palindromic Paths
DP.. f[i][j][k]表示左上结束节点是第i条副对角线上的第j个点,右下结束节点是第n*2-i条副对角线上的第k个点,构成回文的方案数. i那维滚动一下.时间复杂度O(n^3)空间复杂度O(n ...
- [bzoj3203][Sdoi2013]保护出题人
人生第一道三分?... 把进攻序列里的前i只僵尸看成一个点,横坐标是第i只僵尸到达的时间,纵坐标是这i只僵尸的血量总和..就是说植物必须在这段时间内输出这些伤害..那么单位时间的输出伤害就是斜率了. ...
- 一些有用的stl知识《acm程序设计》
accepted 通过 Presentation Error 输出格式错误 Wrong Answer 答案错误 Runtime Error 多为数组访问越界 程序运行时 ...
- the quick brown fox jumps over the lazy dog
THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG