1、常用属性:

frame   bounds   center   alpha    Transition 过渡    transform 动画效果

2、常用方法:

+(void)setAnimationDelegate:(id)delegate;

+(void)setAnimationWillStartSelector:(SEL)selector; 当动画结束的时候,执行delegate对象的selector,并且把beginAnimations:context:中传入的参数传进selector

+ (void)setAnimationDidStopSelector:(SEL)selector;  当动画结束时,执行delegate对象的selector,并且把beginAnimations:context:中传入的参数传进selector

+ (void)setAnimationDuration:(NSTimeInterval)duration;   动画的持续时间,秒为单位

+ (void)setAnimationDelay:(NSTimeInterval)delay;  动画延迟delay秒后再开始

+ (void)setAnimationStartDate:(NSDate *)startDate;   动画的开始时间,默认为now

+ (void)setAnimationCurve:(UIViewAnimationCurve)curve;  动画的节奏控制(过渡)

+ (void)setAnimationRepeatCount:(float)repeatCount;  动画的重复次数

+ (void)setAnimationRepeatAutoreverses:(BOOL)repeatAutoreverses;  如果设置为YES,代表动画每次重复执行的效果会跟上一次相反

+ (void)setAnimationTransition:(UIViewAnimationTransition)transition forView:(UIView *)view cache:(BOOL)cache;  设置视图view的过渡效果, transition指定过渡类型, cache设置YES代表使用视图缓存,性能较好

 #import "ViewController.h"

 @interface ViewController ()
{
UIImageView *imageView;
}
@end @implementation ViewController - (void)viewDidLoad {
[super viewDidLoad]; imageView = [[UIImageView alloc]initWithFrame:self.view.frame];
imageView.image = [UIImage imageNamed:@"7.jpg"];
// imageView.contentMode = UIViewContentModeScaleAspectFit;
[self.view addSubview:imageView]; UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(, , , );
button.center = self.view.center;
button.backgroundColor = [UIColor brownColor];
[button addTarget:self action:@selector(viewAnimation3) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button]; } #pragma mark -- 1、frame bounds center alpha ---
- (void)viewAnimation1 {
#pragma mark - 方法1
// 在一段时间内 执行完命令
// [UIView animateWithDuration:3 animations:^{
// imageView.alpha = 0.5;
// }]; #pragma mark - 方法2
// 开始动画
[UIView beginAnimations:@"animation" context:nil]; // 这只动画的持续时间
[UIView setAnimationDuration:]; // ..... 动画效果
imageView.alpha = 0.5;
imageView.bounds = CGRectMake(, , , );
imageView.center = CGPointMake(, );
// imageView.frame = CGRectMake(100, 100, 100, 100); // 提交动画 会去执行动画
[UIView commitAnimations];
} #pragma mark - 2、Transition
/*
typedef NS_ENUM(NSInteger, UIViewAnimationTransition) {
UIViewAnimationTransitionNone,
UIViewAnimationTransitionFlipFromLeft, 从左面翻转
UIViewAnimationTransitionFlipFromRight,从右面翻转
UIViewAnimationTransitionCurlUp, 向上翻页
UIViewAnimationTransitionCurlDown,向下翻页
};
*/
- (void)viewAnimation2 {
// 开始动画
[UIView beginAnimations:nil context:nil];
// 设置动画持续时间
// [UIView setAnimationDuration:3];
// 设置 UIView 的过渡动画
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:imageView cache:YES]; #pragma mark - 3、UIViewAnimationCurve
/*
typedef NS_ENUM(NSInteger, UIViewAnimationCurve) {
UIViewAnimationCurveEaseInOut, // slow at beginning and end 慢进慢出
UIViewAnimationCurveEaseIn, // slow at beginning 快进
UIViewAnimationCurveEaseOut, // slow at end 快出
UIViewAnimationCurveLinear 匀速
};
*/
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
// 设置 代理(检测动画结束)
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(finishAnimation)];
// 提交动画
[UIView commitAnimations]; } // 动画结束之后触发的方法
- (void)finishAnimation {
[UIView beginAnimations:@"o" context:nil];
[UIView setAnimationDuration:];
imageView.alpha = 0.1;
imageView.bounds = CGRectZero;
imageView.center = CGPointMake(, ); [UIView commitAnimations];
} #pragma mark - 4、transform
/*
imageView.transform=CGAffineTransformScale(imageView.transform, 0.5, 0.5); // 实现的是放大和缩小imageView.transform=CGAffineTransformRotate(imageView.transform, M_PI_4); //实现的是旋转 imageView.transform=CGAffineTransformTranslate(imageView.transform, 20, 0); //实现的是平移
*/
- (void)viewAnimation3 { [UIView beginAnimations:@"animation" context:nil];
[UIView setAnimationDuration:];
// transform 如果没有还原transform 他会保持 改变后的模样
imageView.transform = CGAffineTransformScale(imageView.transform, 0.5, 0.5); [UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(restore)];
[UIView commitAnimations]; } - (void)restore {
[UIView animateWithDuration: animations:^{
imageView.transform = CGAffineTransformIdentity; }];
}

模拟器效果截图:

方法一效果图:

方法二效果图:

方法三效果图:

CoreAnimation 核心动画一 (一些常用属性 和 方法)的更多相关文章

  1. iOS开发CoreAnimation解读之一——初识CoreAnimation核心动画编程

    iOS开发CoreAnimation解读之一——初识CoreAnimation核心动画编程 一.引言 二.初识CoreAnimation 三.锚点对几何属性的影响 四.Layer与View之间的关系 ...

  2. UIView的一些常用属性和方法

    UIView的一些常用属性和方法 1. UIView的属性 UIView继承自UIResponder,拥有touches方法. - (instancetype)initWithFrame:(CGRec ...

  3. SVG DOM常用属性和方法介绍(1)

    12.2  SVG DOM常用属性和方法介绍 将以Adobe SVG Viewer提供的属性和方法为准,因为不同解析器对JavaScript以及相关的属性和方法支持的程度不同,有些方法和属性是某个解析 ...

  4. 第190天:js---String常用属性和方法(最全)

    String常用属性和方法 一.string对象构造函数 /*string对象构造函数*/ console.log('字符串即对象');//字符串即对象 //传统方式 - 背后会自动将其转换成对象 / ...

  5. Node.js process 模块常用属性和方法

    Node.js是常用的Javascript运行环境,本文和大家发分享的主要是Node.js中process 模块的常用属性和方法,希望通过本文的分享,对大家学习Node.js http://www.m ...

  6. ios基础篇(四)——UILabel的常用属性及方法

    UILabel的常用属性及方法:1.text //设置和读取文本内容,默认为nil label.text = @”文本信息”; //设置内容 NSLog(@”%@”, label.text); //读 ...

  7. UITableView常用属性和方法 - 永不退缩的小白菜

    UITableView常用属性和方法 - 永不退缩的小白菜 时间 2014-05-27 01:21:00  博客园精华区原文  http://www.cnblogs.com/zhaofucheng11 ...

  8. UIView常用属性与方法/UIKit继承结构

    UIView常用属性与方法 @interface UIView : UIResponder<NSCoding, UIAppearance, UIAppearanceContainer, UIDy ...

  9. JavaScript中Number常用属性和方法

    title: JavaScript中Number常用属性和方法 toc: false date: 2018-10-13 12:31:42 Number.MAX_VALUE--1.79769313486 ...

随机推荐

  1. 字符集乱码问题:ISO-8859-1和GBK

    问题,引用百度知道的问题吧: http://zhidao.baidu.com/question/51342167.html?qbl=relate_question_0&word=%C3%84% ...

  2. 如何理解js

    1.js/dom功能 2.performance 3.code organization 4.tools and flow 如何理解js代码,代码即业务. 如何快速理解代码业务.

  3. TP复习12

    四.特殊标签 1.比较标签 eq或者 equal 等于 neq 或者notequal 不等于 gt 大于 egt 大于等于 lt 小于 elt 小于等于 heq 恒等于 nheq 不恒等于 2.范围标 ...

  4. MySql服务器的启动和关闭

    转自:http://zqding.iteye.com/blog/1562095 在windows下: 启动: .cd c:\mysql\bin .mysqld --console 关闭: .cd c: ...

  5. Effective_java之二:慎用重载函数

    每周写一篇技术博客的愿望一直没实现, 从这周開始每周五晚10点是写博客的时间 OOP的一个重要特性就是多态,实现多态的目的有多种途径.比方:重载overload.重写overwite.面向接口编程等等 ...

  6. Flex4+Spring3+Hibernate3+BlazeDS整合笔记

    普通Java Web工程流行使用ssh框架,而当前台使用Flex制作的时候,后台就不需要用Struts了,通过使用BlazeDS远程方法调用即可. 首先,新建Java Web工程,然后添加Flex项目 ...

  7. char *a 与char a[] 的区别

    原文:http://www.cnblogs.com/kaituorensheng/archive/2012/10/23/2736069.html char *a = "hello" ...

  8. Golang学习 - 学习资源列表

    Golang 学习资源: <Go 语言圣经(中文版)>  - 书籍 http://shinley.com/index.html <学习 Go 语言> - 书籍 http://w ...

  9. 文件共享windows server 2008 服务器

    1.远程连接到windows server2008 E盘右键共享 2.不能创建文件夹 右键E盘→共享→高级共享→权限→全部打勾即可. 3.ok,文件服务器

  10. Windows 之 删除保存的共享凭据(用户名和密码)

    当我们在访问Windows共享文件夹或者NAS网络共享盘的时候,Windows会提示输入访问共享所需要的用户名和密码,如果我们勾选了“记住我的凭据”,Windows 就会将认证凭据保存到计算机中,以方 ...