动画: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 { // ...
随机推荐
- Memcache笔记04-Memcached机制深入了解
Memcached机制深入了解 ①基于c/s架构 ,协议简单 c/s架构,此时memcached为服务器端,我们可以使用如PHP,c/c++等程序连接memcached服务器. memcached的服 ...
- js中location.href的用法
Javascript中的location.href有很多种用法,主要如下: self.location.href="/url" 当前页面打开URL页面 ocation.href=& ...
- proxool详细配置
proxool详细配置 博客分类: Java 配置管理SQLServletprototypeXML proxool一个数据库连接池框架,提供了对你选择的其它类型的驱动程序的连接池封装.可以非常简单的 ...
- PHP添加Redis模块及连接
上几篇文章介绍了Redis的安装及使用,下面将介绍php如何添加Redis扩展! php手册并没有提供Redis的类和方法,也没有提供相关的扩展模块,但我们可以在Redis的官网下载PHP的扩展,里面 ...
- 设计模式C#实现(二)——适配器模式
适配器模式:将一个类的接口,转换成客户期望的另一个接口.适配器让原本接口不兼容的类可以合作无间. 如果它走起路来像只鸭子,叫起来像只鸭子,那么它必定可能是一只鸭子包装了鸭子适配器的火鸡…… 最近有一个 ...
- rabbitmq server的安装以及常用的命令
Centos 源代码编译 安装 ErlangErlang依赖哪些库? A fully working GCC compiler environment Ncurses developm ...
- jquery获取复选框(checkbox)的选中值(一组和单个)
使用jquery获取一组或者单个checkbox的选中状态的值.下面通过一个示例进行说明,假设现有一页面有一组checkbox的name的值为id,那么获取这组name=id的checkbox的值的方 ...
- Icacls 在windows目录文件授权中的应用
前言 最近因工作需要,需要对批量服务器某一目录下的文件进行统一授权,对于linux来说,授权很方便,对于window来说,要对目录下的文件进行批量授权还是很不方便的,windows平台授权自然想到用i ...
- vs安装mvc
需要一个MVC框架和SP1补丁包,SP1补丁包的下载地址为:http://www.microsoft.com/downloads/details.aspx?FamilyID=27673c47-b3b5 ...
- kafka basic commands
kafka-server-start.sh config/server.properties & kafka-server-stop.sh kafka-topics.sh --creat ...