Hello_IOS ios开发transform属性
#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属性的更多相关文章
- iOS开发 -------- transform属性(形变)
一 transform属性 在OC中,通过transform属性可以修改对象的平移,比例和旋转角度 常用的创建transform结构体的方法分两大类 (1) 创建"基于控件初始位置&qu ...
- ios开发transform属性
#import "ViewController.h" @interface ViewController () @property (weak, nonatomic) IBOutl ...
- iOS开发-automaticallyAdjustsScrollViewInsets属性
iOS开发-automaticallyAdjustsScrollViewInsets属性 Available in iOS 7.0 and later. 简单点说就是automaticallyAdju ...
- iOS开发-获取属性和方法
iOS开发数据存储有两种方式,属性列表和对象编码,属性列表可以通过NSArray,NSMutableArray,NSMutableDictionary,存储对象我们可以通过归档和解档来完成.如果我们想 ...
- iOS开发之--属性关键字以及set和get方法
一.属性分为三大类 1.读写性控制 a.readOnly只读,只会生成get方法,不会生成set方法 b.readWrite可读可写,会生成set方法,也会生成get方法(默认设置) 2.setter ...
- iOS开发transform的使用
// // ViewController.m // 18-transform的使用 #import "ViewController.h" @interface ViewCont ...
- IOS学习5——属性与成员变量
[转]iOS中属性与成员变量的区别 ios中属性修饰符的作用 1. 属性用property声明 2. 简而言之,对于目前的ios开发,属性和成员变量的区别,完全可以不管. 3. 这个是历史原因造成的. ...
- iOS开发基础篇-transform属性
一. transform 属性 在OC中,通过 transform 属性可以修改对象的平移.缩放比例和旋转角度. 1)创建“基于控件初始位置”的形变 CGAffineTransformMakeRot ...
- iOS开发UI篇—transframe属性(形变)
iOS开发UI篇—transframe属性(形变) 1. transform属性 在OC中,通过transform属性可以修改对象的平移.缩放比例和旋转角度 常用的创建transform结构体方法分两 ...
随机推荐
- Sunrise Release Version History
Sunrise Release Version History 1.4.1.0 1.1.0.0 1.0.1.0
- ACM2050前传
n在一个平面上有一个圆和n条直线,这些直线中每一条在圆内 同其他直线相交,假设没有3条直线相交于一点,试问这些直线 将圆分成多少区域. 使用递归 F(1)=2; F(n) = F(n-1)+n; ...
- [转]Numpy中矩阵对象(matrix)
numpy模块中的矩阵对象为numpy.matrix,包括矩阵数据的处理,矩阵的计算,以及基本的统计功能,转置,可逆性等等,包括对复数的处理,均在matrix对象中. class numpy.matr ...
- LCA of a Binary Tree
236. Lowest Common Ancestor of a Binary Tree /** * 基础版 * 给定p,q都是在树中 * 有两种情况: * 1. p和q分布在LCA的两侧 * 2. ...
- Transact-SQL
Transact-SQL(又称T-SQL),是在Microsoft SQL Server和Sybase SQL Server上的ANSI SQL实现,与Oracle的PL/SQL性质相近(不只是实现A ...
- URAL-1998 The old Padawan 二分
题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1998 题意:有n个石头,每个石头有个重量,每个时间点你能让一个石头飞起来,但有m个时间点 ...
- 一个在 Java VM 上使用可观测的序列来组成异步的、基于事件的程序的库 RxJava,相当好
https://github.com/ReactiveX/RxJava https://github.com/ReactiveX/RxAndroid RX (Reactive Extensions,响 ...
- SharePoint咨询师之路:设计之前的那些事一:容量
提示:本系列只是一个学习笔记系列,大部分内容都可以从微软官方网站找到,本人只是按照自己的学习路径来学习和呈现这些知识. 咨询师更多的时候是解决方案提供者,那么他们如何能够提供有效的SharePoint ...
- Apache Spark的部署环境的小记
Spark的单机版便于测试,同时通过SSH用Spark的内置部署脚本搭建Spark集群,使用Mesos.Yarn或者Chef来部署Spark.对于Spark在云环境中的部署,比如在EC2(基本环境和E ...
- string 与char* char[]之间的转换 2015-04-09 11:30 29人阅读 评论(0) 收藏
1.首先必须了解,string可以被看成是以字符为元素的一种容器.字符构成序列(字符串).有时候在字符序列中进行遍历,标准的string类提供了STL容器接口.具有一些成员函数比如begin().en ...