代码:

#import "MainViewController.h"

@interface MainViewController ()

@end

@implementation MainViewController

- (void)viewDidLoad
{
[super viewDidLoad]; UIView *view1 = [[UIView alloc]initWithFrame:[[UIScreen mainScreen] bounds]];
view1.backgroundColor = [UIColor blueColor]; UIView *view2 = [[UIView alloc]initWithFrame:[[UIScreen mainScreen] bounds]];
view2.backgroundColor = [UIColor yellowColor]; [self.view addSubview:view1];
[self.view addSubview:view2];
} -(void) changeView
{
NSLog(@"change view");
CGContextRef context = UIGraphicsGetCurrentContext();
[UIView beginAnimations:nil context:context];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:1.0]; [UIView setAnimationTransition: UIViewAnimationTransitionFlipFromRight forView:self.view cache:YES];
[self.view exchangeSubviewAtIndex: withSubviewAtIndex:]; [UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:nil];
[UIView commitAnimations];
} -(void) changeView2
{
CATransition *animation = [CATransition animation];
[animation setDuration:1.25f];
[animation setTimingFunction:[CAMediaTimingFunction
functionWithName:kCAMediaTimingFunctionEaseIn]];
[animation setType:kCATransitionReveal];
[animation setSubtype: kCATransitionFromRight];
[self.view.layer addAnimation:animation forKey:@"Reveal"]; [self.view exchangeSubviewAtIndex: withSubviewAtIndex:]; [CATransaction commit];
} -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[self changeView];
}
@end

切换view的动画的更多相关文章

  1. AndroidScreenSlide项目切换view动画效果《IT蓝豹》

    AndroidScreenSlide项目切换view动画效果 AndroidScreenSlide项目中有几个不错的效果,一:Card Flip翻页立体效果,二:Screen Slide 左右切换vi ...

  2. jQuery演示10种不同的切换图片列表动画效果

    经常用到的图片插件演示jQuery十种不同的切换图片列表动画效果 在线演示 下载地址 实例代码 <!DOCTYPE html> <html lang="en" c ...

  3. jQuery演示10种不同的切换图片列表动画效果以及tab动画演示 2

    很常用的一款特效纯CSS完成tab实现5种不同切换对应内容效果 实例预览 下载地址 实例代码 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 ...

  4. iOS 开发笔记-控制器tab切换view显示

    在开发过程中,我们常常会碰到一种情况就是,在一个controller里面,经常要放很多复杂的控制,最常用的就是tar切换.tar切换,原理就是在一个controller里面,显示另一个controll ...

  5. 如何递归执行view的动画

    如何递归执行view的动画 效果: 山寨的源头: 图片素材: 源码: // // ViewController.m // RepeatAnimationView // // Created by Yo ...

  6. cocos2dx切换播放的动画

    版本:cocos2dx 2.2.6 IDE: VS2012 语言:C++98 美术资源一共有两段动画的序列帧,一个是手绘马行走图,一个是分子人行走图. 程序要实现的目的就是在同一个位置,点击按钮可以实 ...

  7. js写的数码时钟,在“最小化”浏览器 或者 “切换网页”是动画效果好像不对

    一.问题 在“最小化”浏览器 或者 “切换网页”是动画效果不对,不知道哪里出了问题???是不是”最小化“时网页定时器关掉了,还是其他什么原因啊 ???? 二.HTML代码如下 <div id=& ...

  8. 看完这篇再不会 View 的动画框架,我跪搓衣板

    引言 众所周知,一款没有动画的 app,就像没有灵魂的肉体,给用户的体验性很差.现在的 android 在动画效果方面早已空前的发展,1.View 动画框架 2.属性动画框架 3.Drawable 动 ...

  9. ViewPager实现滑屏切换页面及动画效果(仿优酷客户端)

     找了许多实现该功能的例子,但效果都不很理想,于是自己结合网上的资源及自己的总结,整理了一下,发出来,供大家参考.这个是自己做的,仿优酷客户端的. 先看效果: ****************** ...

随机推荐

  1. ABAP提示信息对话框

     1.   call function 'POPUP_TO_CONFIRM_WITH_MESSAGE'         exporting           diagnosetext1 = '数据为 ...

  2. mysql日期时间函数2

    win7可以设定每周从哪一天开始,win2003等不能方便的修改.有的是周日开始,有的是周一开始.而工作中有的时候每周是从周六开始算的,有些数据需要按周统计,那么那种方式比较好呢?   通过下面的研究 ...

  3. CHENEY-YANG'S BLOG(cheney-yang)

    This is Cheney-Yang's blog ! Welcome to here ! This is Cheney-Yang's blog ! Welcome to here ! This i ...

  4. Boost Build

    Window XP + Visual Studio 2008 获取Boost库源码 我们可以从http://www.boost.org/ 上获取boost的源代码.当前最新版本为1.45.0. 解压到 ...

  5. PHP+jQuery+Ajax实现用户登录与退…

    用户登录与退出功能应用在很多地方,而在有些项目中,我们需要使用Ajax方式进行登录,登录成功后只刷新页面局部,从而提升了用户体验度.本文将使用PHP和jQuery来实现登录和退出功能. 查看演示DEM ...

  6. 自己做的demo---宣告可以在java世界开始自由了

    package $interface; public interface ILeaveHome { public abstract int a(); public abstract int b(); ...

  7. PS软件之,快速的修改图片你的尺寸

    进入 -- 图像 --- 图像尺寸 -- (前面两个去掉后,只剩下最后一个选项的时候就能够任意的修改图像的尺寸)

  8. Lucida Grande字体无法正常显示冒号的解决方案

    曾经贪图Mac OSX的UI漂亮,后来查到它用的是Lucida Grande字体,所以索性将win7也改成了那种字体,结果浏览器中的中文冒号全都显示为一个奇怪的符号.后来即使将字体设置回去也无法还原. ...

  9. .NET设计模式(7):创建型模式专题总结(Creational Pattern)

    ):创建型模式专题总结(Creational Pattern)    创建型模式专题总结(Creational Pattern) --.NET设计模式系列之七 Terrylee,2006年1月 转载: ...

  10. 一个实例明白AutoResetEvent和 ManulResetEvent的用法

    先看一段代码: public class WaitHandlerExample {                 public static AutoResetEvent waitHandler;  ...