#import "ViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *imageV; @end @implementation ViewController - (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
} - (IBAction)moveUp:(id)sender {
//平移
[UIView animateWithDuration:0.5 animations:^{
//使用Make,它是相对于最原始的位置做的形变.不累加形变,且多次点击只形变一次
//self.imageV.transform = CGAffineTransformMakeTranslation(0, -100);
//相对于上一次做形变.初始值self.imageV.transform为0,多次点击,会自动在上一次形变的基础上做平移
self.imageV.transform = CGAffineTransformTranslate(self.imageV.transform, 0, -100);
}]; }
- (IBAction)moveDown:(id)sender { //平移
[UIView animateWithDuration:0.5 animations:^{
//使用Make,它是相对于最原始的位置做的形变.
//self.imageV.transform = CGAffineTransformMakeTranslation(0, -100);
//相对于上一次做形变.
self.imageV.transform = CGAffineTransformTranslate(self.imageV.transform, 0, 100);
}];
} - (IBAction)rotation:(id)sender { [UIView animateWithDuration:0.5 animations:^{ //旋转(旋转的度数, 是一个弧度),M_PI_4,_下划线表示一个除号/
//self.imageV.transform = CGAffineTransformMakeRotation(M_PI_4); self.imageV.transform = CGAffineTransformRotate(self.imageV.transform, M_PI_4); }]; }
- (IBAction)scale:(id)sender { [UIView animateWithDuration:0.5 animations:^{ //缩放
//self.imageV.transform = CGAffineTransformMakeScale(0.5, 0.5);
self.imageV.transform = CGAffineTransformScale(self.imageV.transform, 0.8, 0.8); }]; } /**
* 总结: 1:平移:transform是结构体,定义一个transform:CGAffineTransform form //使用Make,它是相对于最原始的位置做的形变.不累加形变,且多次点击只形变一次
//self.imageV.transform = CGAffineTransformMakeTranslation(0, -100);
//相对于上一次做形变.初始值self.imageV.transform为0,多次点击,会自动在上一次形变的基础上做平移
self.imageV.transform = CGAffineTransformTranslate(self.imageV.transform, 0, -100); 2:旋转:
//旋转(旋转的度数, 是一个弧度),M_PI_4,_下划线表示一个除号/
//self.imageV.transform = CGAffineTransformMakeRotation(M_PI_4); self.imageV.transform = CGAffineTransformRotate(self.imageV.transform, M_PI_4); 3:缩放:
//缩放
//self.imageV.transform = CGAffineTransformMakeScale(0.5, 0.5);
self.imageV.transform = CGAffineTransformScale(self.imageV.transform, 0.8, 0.8); 4:清空形变属性:
CGAffineTransform form = CGAffineTransformIdentity;
self.imageV.transform = form; 5:1:在实际开发中,使用场景:1:当涉及一些frame的改变或是形变的时候可以用transform来取代frame 2:一般在实际开发中都是平移,旋转缩放混合使用。 */ @end

Hello_IOS ios开发transform属性的更多相关文章

  1. iOS开发 -------- transform属性(形变)

      一 transform属性 在OC中,通过transform属性可以修改对象的平移,比例和旋转角度 常用的创建transform结构体的方法分两大类 (1) 创建"基于控件初始位置&qu ...

  2. ios开发transform属性

    #import "ViewController.h" @interface ViewController () @property (weak, nonatomic) IBOutl ...

  3. iOS开发-automaticallyAdjustsScrollViewInsets属性

    iOS开发-automaticallyAdjustsScrollViewInsets属性 Available in iOS 7.0 and later. 简单点说就是automaticallyAdju ...

  4. iOS开发-获取属性和方法

    iOS开发数据存储有两种方式,属性列表和对象编码,属性列表可以通过NSArray,NSMutableArray,NSMutableDictionary,存储对象我们可以通过归档和解档来完成.如果我们想 ...

  5. iOS开发之--属性关键字以及set和get方法

    一.属性分为三大类 1.读写性控制 a.readOnly只读,只会生成get方法,不会生成set方法 b.readWrite可读可写,会生成set方法,也会生成get方法(默认设置) 2.setter ...

  6. iOS开发transform的使用

    // //  ViewController.m //  18-transform的使用 #import "ViewController.h" @interface ViewCont ...

  7. IOS学习5——属性与成员变量

    [转]iOS中属性与成员变量的区别 ios中属性修饰符的作用 1. 属性用property声明 2. 简而言之,对于目前的ios开发,属性和成员变量的区别,完全可以不管. 3. 这个是历史原因造成的. ...

  8. iOS开发基础篇-transform属性

    一. transform 属性 在OC中,通过 transform 属性可以修改对象的平移.缩放比例和旋转角度. 1)创建“基于控件初始位置”的形变  CGAffineTransformMakeRot ...

  9. iOS开发UI篇—transframe属性(形变)

    iOS开发UI篇—transframe属性(形变) 1. transform属性 在OC中,通过transform属性可以修改对象的平移.缩放比例和旋转角度 常用的创建transform结构体方法分两 ...

随机推荐

  1. latex公式中的空格如何表示

    两个quad空格 a \qquad b 两个m的宽度 quad空格 a \quad b 一个m的宽度 大空格 a\ b 1/3m宽度 中等空格 a\;b 2/7m宽度 小空格 a\,b 1/6m宽度 ...

  2. MFC中GetPrivateProfileString相关函数

    项目中用到了这个函数,所以了解了一下,参考了一些博客: http://blog.sina.com.cn/s/blog_a599b5960101tsbk.html http://blog.csdn.ne ...

  3. How to Keep Alive SSH Sessions

    How to Keep Alive SSH Sessions Many NAT firewalls time out idle sessions after a certain period of t ...

  4. 苹果官网 demo The Elements 阅读随笔

    The Elements https://developer.apple.com/library/ios/samplecode/TheElements/Introduction/Intro.html# ...

  5. ZOJ-3686 A Simple Tree Problem 线段树

    题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3686 题意:给定一颗有根树,每个节点有0和1两种值.有两种操作: ...

  6. 第三百二十七天 how can I 坚持

    都没心情学习了,睡觉.太失败了.  好了,你赢了,最怕女人不说话了,我妈一生气就不说话,有点怕我妈,你想删就把我删了吧,我不怪你. 给你个善意的建议,任何事情都要有度,过犹而不及,你是属于那种比较听家 ...

  7. 支付结果回调v7核心,投保确认接口..

    <?xml version="1.0" encoding="GBK"?> <PACKET type="REQUEST"&g ...

  8. Ubuntu之系统交换分区Swap增加与优化

    http://os.51cto.com/art/201212/372860.htm   http://blog.csdn.net/xingyu15/article/details/5570225   ...

  9. HDU1963Investment(DP)

    简单DP,题解见代码

  10. [Linux]常用命令与目录全拼

    命令缩写: ls:list(列出目录内容)cd:Change Directory(改变目录)su:switch user 切换用户rpm:redhat package manager 红帽子打包管理器 ...