转载请说明(谢谢)

http://blog.csdn.net/a21064346/article/details/7851695

点击打开链接

以下 一个系列的 动画效果 在 UIView.h文件中可以查找。但是比较炫丽的一些动画,就需要用到下一章节的coreAnimation。其中需要添加

QuartzCore

CoreGraphics

这两个framework

本人偷懒,就不搭建框架了。自己把方法复制到m文件里:)

//渐变 和 移动

- (UIGestureRecognizer *)createTapRecognizerWithSelector:(SEL)selector {

return [[[UITapGestureRecognizeralloc]initWithTarget:selfaction:selector]autorelease];

}

- (void)viewDidLoad {

[superviewDidLoad];

fadeMeView = [[UIViewalloc]initWithFrame:CGRectMake(55,40,210,160)];

fadeMeView.backgroundColor
= [UIColorcolorWithRed:0.580green:0.706blue:0.796alpha:1.000];

[self.viewaddSubview:fadeMeView];

moveMeView = [[UIViewalloc]initWithFrame:CGRectMake(55,220,210,160)];

moveMeView.backgroundColor
= [UIColorcolorWithRed:1.000green:0.400blue:0.400alpha:1.000];

[self.viewaddSubview:moveMeView];

[fadeMeViewaddGestureRecognizer:[selfcreateTapRecognizerWithSelector:@selector(fadeMe)]];

[moveMeViewaddGestureRecognizer:[selfcreateTapRecognizerWithSelector:@selector(moveMe)]];

}

- (void)fadeMe {

[UIViewanimateWithDuration:1.0animations:^{

fadeMeView.alpha
= 0.0f;

}];

}

- (void)moveMe {

[UIViewanimateWithDuration:0.5animations:^{

moveMeView.center
= CGPointMake(moveMeView.center.x,moveMeView.center.y
-200);

}];

}

//翻书 翻页效果

- (void)CurlUp {

[UIViewtransitionWithView:noteViewduration:0.6

options:UIViewAnimationOptionTransitionCurlUp

animations:^{

NSString *currentText =noteView.text;

noteView.text =nextText;

self.nextText = currentText;

}completion:^(BOOL finished){

}];

}

//同一容器中, view 左右来回翻转替换

- (void)viewDidLoad {

[superviewDidLoad];

self.title = [[selfclass]displayName];

// Set the background color for the window.  The user will see the window's background color on the transition.

UIColor *backgroundColor = [UIColorcolorWithPatternImage:[UIImageimageNamed:@"pattern.png"]];

[UIApplicationsharedApplication].keyWindow.backgroundColor
= backgroundColor;

frontView = [[UIViewalloc]initWithFrame:self.view.bounds];

frontView.backgroundColor
= [UIColorcolorWithRed:0.345green:0.349blue:0.365alpha:1.000];

UIImageView *caLogoView = [[UIImageViewalloc]initWithImage:[UIImageimageNamed:@"caLogo.png"]];

caLogoView.frame =CGRectMake(70,80,
caLogoView.bounds.size.width, caLogoView.bounds.size.height);

[frontViewaddSubview:caLogoView];

UIImage *backImage = [UIImageimageNamed:@"backView.png"];

backView = [[UIImageViewalloc]initWithImage:backImage];

backView.userInteractionEnabled
= YES;

[self.viewaddSubview:backView];

[self.viewaddSubview:frontView];

displayingFrontView =YES;

UIGestureRecognizer *frontViewTapRecognizer = [[UITapGestureRecognizeralloc]initWithTarget:selfaction:@selector(flipViews)];

UIGestureRecognizer *backViewTapRecognizer = [[UITapGestureRecognizeralloc]initWithTarget:selfaction:@selector(flipViews)];

[frontViewaddGestureRecognizer:frontViewTapRecognizer];

[backViewaddGestureRecognizer:backViewTapRecognizer];

[frontViewTapRecognizerrelease];

[backViewTapRecognizerrelease];

}

- (void)flipViews {

[UIViewtransitionFromView:(displayingFrontView)
?frontView : backView

toView:(displayingFrontView)
? backView : frontView

duration:0.75

options:(displayingFrontView
?UIViewAnimationOptionTransitionFlipFromRight :UIViewAnimationOptionTransitionFlipFromLeft)

completion:^(BOOL finished) {

if (finished) {

displayingFrontView = !displayingFrontView;

}

}];

}

动画:UIKitAnimation 简单动画学习 iOS (一) 渐变 、 移动 、翻页、来回翻转 ——转载的更多相关文章

  1. iOS实现地图半翻页效果--老代码备用参考

    // Curl the image up or down CATransition *animation = [CATransition animation]; [animation setDurat ...

  2. iOS 开发笔记-控制器翻页

    找了一天,终于找到了两个能用的. 1.https://github.com/wangmchn/WMPageController 2.https://github.com/everettjf/EVTTa ...

  3. iOS 禁止手势滑动翻页

    - (void)viewDidAppear:(BOOL)animated{ [super viewDidAppear:animated]; // 禁用 iOS7 返回手势 if ([self.navi ...

  4. UIView简单动画

    UIView动态实现的效果有以下几种: 1.动态改变frame 2.动态改变color 3.动态改变alpha 4.动态改变bounds 首先,我们先看几种BasicView动画 #pragma ma ...

  5. 6个超炫酷的HTML5电子书翻页动画

    相信大家一定遇到过一些电子书网站,我们可以通过像看书一样翻页来浏览电子书的内容.今天我们要分享的HTML5应用跟电子书翻页有关,我们精选出来的6个电子书翻页动画都非常炫酷,而且都提供源码下载,有需要的 ...

  6. Vue 左右翻页,点赞动画

    因做小活动比较多,使用了一些动画,做些笔记,供大家参考 翻页动画 router -> index.js import Vue from 'vue'; import Router from 'vu ...

  7. iOS CAReplicatorLayer 简单动画

    代码地址如下:http://www.demodashi.com/demo/11601.html 写在最前面,最近在看学习的时候,偶然间发现一个没有用过的Layer,于是抽空研究了下,本来应该能提前记录 ...

  8. iOS中动画的简单使用

    iOS中的动画右两大类1.UIView的视图动画2.Layer的动画 UIView的动画也是基于Layer的动画动画的代码格式都很固定 1.UIView动画 一般方式[UIView beginAnim ...

  9. ios状态栏调整 简单动画的知识点

    首先状态栏式view的属性,所以在viewController中直接重写: /** 修改状态栏 */ - (UIStatusBarStyle)preferredStatusBarStyle { // ...

随机推荐

  1. 转 自定义View之onMeasure()

    可以说重载onMeasure(),onLayout(),onDraw()三个函数构建了自定义View的外观形象.再加上onTouchEvent()等重载视图的行为,可以构建任何我们需要的可感知到的自定 ...

  2. [LoadRunner]性能测试实践_Hessian协议脚本编写2

    协议选取和运行配置请参考:http://www.cnblogs.com/whylaughing/p/5430821.html 这次直接贴代码让大家参考: import lrapi.lr; import ...

  3. [QualityCenter]设置工作流脚本-缺陷字段值发生变化时的处理

    需求:缺陷状态发生不同变化时,系统会的自动处理一些字段值的变化 在脚本编辑器找到Defects_Bug_FieldChange函数,然后填写以下代码: Sub Defects_Bug_FieldCha ...

  4. Effective Java 45 Minimize the scope of local variables

    Principle The most powerful technique for minimizing the scope of a local variable is to declare it ...

  5. eclipse 快捷键Alt+/ 不能补充syso

    通过两步来解决 1:Window->Preferences->General->Keys,输入content assist,把Binding改成alt + / 2:在下面,有一个wh ...

  6. python split()函数使用拆分字符串 将字符串转化为列表

    函数:split()Python中有split()和os.path.split()两个函数,具体作用如下:split():拆分字符串.通过指定分隔符对字符串进行切片,并返回分割后的字符串列表(list ...

  7. Java dynamical proxy demo

    今天练习了一下动态代理的一个方面,假设使用它来完成自动设置默认不提交,启动事务,获取到异常则回滚,正常执行则提交. 如果不使用动态代理,则需要在每个方法本身里面设置Connection,写try,ca ...

  8. Hadoop 分布式文件系统 - HDFS

    当数据集超过一个单独的物理计算机的存储能力时,便有必要将它分不到多个独立的计算机上.管理着跨计算机网络存储的文件系统称为分布式文件系统.Hadoop 的分布式文件系统称为 HDFS,它 是为 以流式数 ...

  9. 转载:HttpClient使用详解

    原文地址:http://blog.csdn.net/wangpeng047/article/details/19624529 Http协议的重要性相信不用我多说了,HttpClient相比传统JDK自 ...

  10. js统计字符串中各种字符情况

    问题描述:在一个字符串中,统计出大写字母.小写字母.数字和其他字符各数.这个算法以前在学习java的时候,老师说过,而且说了四种算法.在孔乙己的世界里,茴香豆的"茴"字有四种写法嘛 ...