动画:UIKitAnimation 简单动画学习 iOS (一) 渐变 、 移动 、翻页、来回翻转 ——转载
转载请说明(谢谢)
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 (一) 渐变 、 移动 、翻页、来回翻转 ——转载的更多相关文章
- iOS实现地图半翻页效果--老代码备用参考
// Curl the image up or down CATransition *animation = [CATransition animation]; [animation setDurat ...
- iOS 开发笔记-控制器翻页
找了一天,终于找到了两个能用的. 1.https://github.com/wangmchn/WMPageController 2.https://github.com/everettjf/EVTTa ...
- iOS 禁止手势滑动翻页
- (void)viewDidAppear:(BOOL)animated{ [super viewDidAppear:animated]; // 禁用 iOS7 返回手势 if ([self.navi ...
- UIView简单动画
UIView动态实现的效果有以下几种: 1.动态改变frame 2.动态改变color 3.动态改变alpha 4.动态改变bounds 首先,我们先看几种BasicView动画 #pragma ma ...
- 6个超炫酷的HTML5电子书翻页动画
相信大家一定遇到过一些电子书网站,我们可以通过像看书一样翻页来浏览电子书的内容.今天我们要分享的HTML5应用跟电子书翻页有关,我们精选出来的6个电子书翻页动画都非常炫酷,而且都提供源码下载,有需要的 ...
- Vue 左右翻页,点赞动画
因做小活动比较多,使用了一些动画,做些笔记,供大家参考 翻页动画 router -> index.js import Vue from 'vue'; import Router from 'vu ...
- iOS CAReplicatorLayer 简单动画
代码地址如下:http://www.demodashi.com/demo/11601.html 写在最前面,最近在看学习的时候,偶然间发现一个没有用过的Layer,于是抽空研究了下,本来应该能提前记录 ...
- iOS中动画的简单使用
iOS中的动画右两大类1.UIView的视图动画2.Layer的动画 UIView的动画也是基于Layer的动画动画的代码格式都很固定 1.UIView动画 一般方式[UIView beginAnim ...
- ios状态栏调整 简单动画的知识点
首先状态栏式view的属性,所以在viewController中直接重写: /** 修改状态栏 */ - (UIStatusBarStyle)preferredStatusBarStyle { // ...
随机推荐
- Java中的 WeakReference 和 SoftReference
我们知道Java语言中没有指针,取而代之的是引用reference.Java中的引用又可以分为四种:强引用,弱引用(WeakReference),软引用(SoftReference),虚引用(Phan ...
- 读书笔记——Windows核心编程(8)Interlocked系列函数
先让我们来复习下小学知识 A+B=C//式中A为被加数,B为加数. A-B=C//式中A为被减数,B为减数. 再让我们来明确一个知识点:返回值为void的Windows函数意味着一定会执行成功. -- ...
- 10个值得深思的PHP面试问题
本文所罗列的问题虽然看似简单,但是每个背后都涵盖了一个或几个大家容易忽视的基础知识点,希望能够帮助到你的面试和平时工作. Q1 第一个问题关于弱类型 $str1 = 'yabadabadoo'; $s ...
- 标准C IO函数和 内核IO函数 效率(时间)比较
前言 标准C提供的文件相关的IO函数,除标准错误输出是不带缓冲的(可以尽快的将错误消息显示出来)之外,所有与终端相关的都是行缓冲,其余都是全缓冲的. 我们可以使用setbuf,setvbuf改变指定流 ...
- [转]excel set drop-down values based on vlookup
本文转自:http://stackoverflow.com/questions/10657811/set-drop-down-values-based-on-vlookup 问: I have a w ...
- NOIP2013普及组 -SilverN
T1 计数问题 题目描述 试计算在区间 1 到 n 的所有整数中,数字 x(0 ≤ x ≤ 9)共出现了多少次?例如,在 1 到 11 中,即在 1.2.3.4.5.6.7.8.9.10.11 中, ...
- shell script 学习笔记-----命令执行
1.PATH变量:shell最主要的功能就是执行用户输入的命令,例如当用户输入一条“ls”命令之后,shell就要找到该命令对应的文件并执行.通常shell都会设置一个名叫PATH的环境变量,其中保存 ...
- ZBrush中如何才能快速完成脸部雕刻(下)
骨骼,是一门基础艺术,几百年来一直为伟大的艺术大师所研究,它曾经,也将一直是创作现实且可信角色的关键,提高骨骼知识更将大大提高雕刻技能. 查看更多内容请直接前往:http://www.zbrush ...
- python中thread模块中join函数
http://www.cnblogs.com/vingi/articles/2657790.html for i in range(10): t = ThreadTest(i) thread_arr. ...
- UESTC 912 树上的距离 --LCA+RMQ+树状数组
1.易知,树上两点的距离dis[u][v] = D[u]+D[v]-2*D[lca(u,v)] (D为节点到根节点的距离) 2.某条边<u,v>权值一旦改变,将会影响所有以v为根的子树上的 ...