iOS页面切换动画实现方式。

  1.使用UIView animateWithDuration:animations:completion方法

  Java代码
  

  1. [UIView animateWithDuration:0.2f animations:^{
  2.   detail.view.frame = CGRectMake(0, 0, detail.view.frame.size.width, detail.view.frame.size.height);
  3.   } completion:^(BOOL finished) {
  4.   UITableViewCell *cell = [articleTable cellForRowAtIndexPath:idx];
  5.   cell.backgroundColor = [UIColor clearColor];
  6.   }];

复制代码

  2.使用UIView beginAnimations:context和UIView commitAnimations方法

  Java代码

  1.   [UIView beginAnimations:nil context: nil];
  2.   [UIView setAnimationDuration:1.0];
  3.   [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];//指定动画曲线
  4.   [UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.view cache:YES];//指定动画方式为卷帘向下,类似的动画切换方式有CurlUp、FlipFromLeft、FlipFromRight,对应Apple Developer Documents中的枚举结构如下
  5.   //UIViewAnimationTransition
  6.   //Specifies a transition to apply to a view in an animation block.
  7.   //typedef enum {
  8.   // UIViewAnimationTransitionNone,
  9.   // UIViewAnimationTransitionFlipFromLeft,
  10.   // UIViewAnimationTransitionFlipFromRight,
  11.   // UIViewAnimationTransitionCurlUp,
  12.   // UIViewAnimationTransitionCurlDown,
  13.   //} UIViewAnimationTransition;
  14.   //要动画改变的属性
  15.   self.view.alpha = 0.0;//动画改变透明度
  16.   self.view.frame = CGRectMake(10, 10, 50, 50);//动画将视图改变到指定位置指定大小
  17.   [self.view exchangeSubviewAtIndex:1 withSubviewAtIndex:0];
  18.   [UIView commitAnimations];//提交动画

复制代码

  3.使用QuartzCore框架中的CATransition

  Java代码
 

  1.  CATransition *animation = [CATransition animation];
  2.   animation.delegate = self;
  3.   animation.duration = kDuration;
  4.   animation.timingFunction = UIViewAnimationCurveEaseInOut;//动画的开始与结束的快慢
  5.   animation.type = kCATransitionFade;//指定动画方式为Fade渐隐消去、类似还有kCATransitionPush、kCATransitionReveal、kCATransitionMoveIn、@"cube"、@"suckEffect"、@"oglFlip"、@"rippleEffect"、@"pageCurl"、@"pageUnCurl"、@"cameraIrisHollowOpen"、@"cameraIrisHollowClose"等,
  6.   //pageCurl 向上翻一页
  7.   //pageUnCurl 向下翻一页
  8.   //rippleEffect 滴水效果
  9.   //suckEffect 收缩效果,如一块布被抽走
  10.   //cube 立方体效果
  11.   //oglFlip 上下翻转效果
  12.   //cameraIrisHollowOpen 相机打开效果
  13.   //cameraIrisHollowClose 相机关闭效果
  14.   Apple Developer Documents中介绍如下
  15.   //Common Transition Types
  16.   //These constants specify the transition types that can be used with the type property.
  17.   //NSString * const kCATransitionFade;
  18.   //NSString * const kCATransitionMoveIn;
  19.   //NSString * const kCATransitionPush;
  20.   //NSString * const kCATransitionReveal;
  21.   animation.subtype = kCATransitionFromLeft;//指定动画进行方向从左边开始,类似还有kCATransitionFromBottom、kCATransitionFromRight、kCATransitionFromTop,Apple Developer Documents中介绍如下
  22.   //Common Transition Subtypes
  23.   //These constants specify the direction of motion-based transitions. They are used //with the subtype property.
  24.   //NSString * const kCATransitionFromRight;
  25.   //NSString * const kCATransitionFromLeft;
  26.   //NSString * const kCATransitionFromTop;
  27.   //NSString * const kCATransitionFromBottom;
  28.   [self.view exchangeSubviewAtIndex:1 withSubviewAtIndex:0];
  29.   [[self.view layer] addAnimation:animation forKey:@"animation"];

复制代码

原文链接:http://www.apkbus.com/android-131034-1-1.html

iOS页面切换动画实现方式。的更多相关文章

  1. (原)android中的动画(三)之动画监听&页面切换动画

    1.动画也可以设置监听事件,例如在动画结束时需要执行某操作 把要执行的代码写在onAnimationEnd()回调方法中即可: anim.setAnimationListener(new Animat ...

  2. iOS页面间传值的方式(NSUserDefault/Delegate/NSNotification/Block/单例)

    iOS页面间传值的方式(NSUserDefault/Delegate/NSNotification/Block/单例) 实现了以下iOS页面间传值:1.委托delegate方式:2.通知notific ...

  3. 【转】iOS页面间传值的方式(Delegate/NSNotification/Block/NSUserDefault/单例)-- 不错

    原文网址:http://www.cnblogs.com/JuneWang/p/3850859.html iOS页面间传值的方式(NSUserDefault/Delegate/NSNotificatio ...

  4. iOS页面间传值的方式 (Delegate/NSNotification/Block/NSUserDefault/单例)

    iOS页面间传值的方式(Delegate/NSNotification/Block/NSUserDefault/单例)   iOS页面间传值的方式(NSUserDefault/Delegate/NSN ...

  5. QtQuick多页面切换、多页面切换动画、多个qml文件数据交互

    一.QtQuick多页面切换方法 (1)“隐藏法” 前一个视图visible设为false或者透明度opacity设为0,相当于“隐藏”了,实际还存在: 要显示的视图visible设为true或者透明 ...

  6. Android5.0之后的页面切换动画

    Android5.0之后给我们开发者剩了好多的事情,为什么这么说呢?还记得刚开始的时候,Android里面的所有的动画都要我们开发者自己来写,现在不需要了,因为5.0之后自带了好多的动画,比如:按钮点 ...

  7. iOS页面间传值的方式(Delegate/NSNotification/Block/NSUserDefault/单例)

    iOS页面间传值实现方法:1.通过设置属性,实现页面间传值:2.委托delegate方式:3.通知notification方式:4.block方式:5.UserDefault或者文件方式:6.单例模式 ...

  8. PresentViewController切换界面(一些系统自带的页面切换动画)

    视图切换,没有NavigationController的情况下,一般会使用presentViewController来切换视图并携带切换时的动画, 其中切换方法如下: – presentViewCon ...

  9. Windows Phone使用sliverlight toolkit实现页面切换动画效果

    使用应用时,好多app在页面切换的时候都有一个动画效果,感觉很炫,也大大增加了用户体验,怎么实现呢? 界面的切换,可以用Windows Phone Toolkit中的TransitionService ...

随机推荐

  1. ISE14.7兼容性问题集锦

    六.WARNING:iMPACT:923 - Can not find cable, check cable setup ! 这个错误是由于驱动没有安装或者驱动安装有问题,一般ISE会在安装的时候把驱 ...

  2. SQL数据开发(经典) 基本操作

    数据开发(经典) 1.按姓氏笔画排序: Select * From TableName Order By CustomerName Collate Chinese_PRC_Str oke_ci_as ...

  3. loadrunner-获取返回值和自定义参数(参数运算)

    实例:手机端操作,A新增了一条事件(返回结果:事件id,例如:1), A这时需要获取新增产生的事件id,并作为参数进行传递,才能将这条事件上报给B(返回结果:事件id不变,步骤id等于事件id加1), ...

  4. 开发中使用UEditor编辑器的注意事项

    最近在一个刚结束的一个项目中使用到了UEditor编辑器,下面总结一下遇到的问题以及使用时需要注意的地方: 1. 使用UEditor插件需要先对其进行路径配置: 在ueditor.config.js文 ...

  5. Java多线程学习开发笔记

    线程有有序性和可见性 多个线程之间是不能直接传递数据交互的,它们之间的交互只能通过共享变量来实现. 在多个线程之间共享类的一个对象,这个对象是被创建在主内存(堆内存)中,每个线程都有自己的工作内存(线 ...

  6. UESTC 1591 An easy problem A【线段树点更新裸题】

    An easy problem A Time Limit: 2000/1000MS (Java/Others)     Memory Limit: 65535/65535KB (Java/Others ...

  7. UR11 A.元旦老人与汉诺塔

    题目:http://uoj.ac/contest/23/problem/167 如果我们拿个map来存状态的话.设当前状态是v,下一个状态是s.有f[i+1][s]+=f[i][v]. 初始f[0][ ...

  8. Spring框架学习笔记(10)——Spring中的事务管理

    什么是事务 举例:A给B转500,两个动作,A的账户少500,B的账户多500 事务就是一系列的动作, 它们被当做一个单独的工作单元. 这些动作要么全部完成, 要么全部不起作用 一.注解添加事务管理方 ...

  9. angular 表达式与指令

    angular表达式的一些特点 属性表达式: 属性表达式是对应于当前作用域,Javascript对应的是全局window对象. AngularJS要使用window作用域的话得用$window来指向全 ...

  10. WPF 简单的循环GIF播放

    //MVVM要事件绑定,记得项目引用类库“Sysrem.Windows.interactivity”,然后XAML引用 xmlns:i="http://schemas.microsoft.c ...