iOS:UIView的CALayer基本演练
//添加button
UIButton *button = [[UIButton alloc]init];
//设置frame
button.frame = CGRectMake(, , , );
//背景色
button.layer.backgroundColor = [[UIColor redColor]CGColor];
[self.view addSubview:button];
//演示结果

//设置圆角
//设置圆角半径
button.layer.cornerRadius = 50.0;
//演示结果

//设置边框
//设置边框(颜色、边宽)
button.layer.borderColor = [[UIColor greenColor]CGColor];
button.layer.borderWidth = 2.0;
//演示结果

//设置阴影
//设置阴影(颜色、偏移量、透明度、半径)
button.layer.shadowColor = [[UIColor purpleColor]CGColor];
button.layer.shadowOffset = CGSizeMake(, );
button.layer.shadowOpacity = 1.0;
button.layer.shadowRadius = 20.0;
//演示结果

//添加内容
//设置内容
button.layer.contents = (id)[[UIImage imageNamed:@"2.png"] CGImage];
//演示结果

//设置平移(每一个轴平移长度)
button.layer.transform = CATransform3DMakeTranslation(, , 0.0);
//恢复平移
//button.layer.transform = CATransform3DIdentity;
//设置旋转(旋转角度、x轴、y轴、z轴)
button.layer.transform = CATransform3DMakeRotation(M_PI, , , );
//恢复旋转
//button.layer.transform = CATransform3DIdentity;
//演示结果

//进行放缩形变并恢复原状
//设置放缩(每一个轴方向放缩大小系数)
button.layer.transform = CATransform3DMakeScale(, , );
//恢复放缩
//button.layer.transform = CATransform3DIdentity;
//演示结果

iOS:UIView的CALayer基本演练的更多相关文章
- iOS 杂笔-20(UIView和CALayer的区别与联系)
iOS 杂笔-20(UIView和CALayer的区别与联系) 每个 UIView 内部都有一个 CALayer 在背后提供内容的绘制和显示,并且 UIView 的尺寸样式都由内部的 Layer 所提 ...
- iOS核心动画CALayer和UIView
UIView和CALayer的关系. 每一个UIview都有一个CALayer实例的图层属性,也就是所谓的backing layer. 实际上这些背后关联的图层才是真正用来在屏幕上显示和做动画,UIV ...
- IOS Intro - UIWindow UIView and CALayer
UIWindow.UIView以及CALayer之间的关系2016-05-11 20:46 本站整理 浏览(16) UIWindow1.简介UIWindow是一种特殊的UIView,通常在一个app中 ...
- iOS 中 UIView 和 CALayer 的关系
UIView 有一个名叫 layer ,类型为 CALayer 的对象属性,它们的行为很相似,主要区别在于:CALayer 继承自 NSObject ,不能够响应事件. 这是因为 UIView 除了负 ...
- UIView和CALayer的区别
CALayer属于Core Animation部分的内容,比较重要而不太好理解.以下是园子中看到的一篇文章的摘录: 以下摘自<<核心动画编程指南>>: 两者最大的区别是,图层不 ...
- ios uiview封装动画(摘录)
iOS开发UI篇—核心动画(UIView封装动画) 一.UIView动画(首尾) 1.简单说明 UIKit直接将动画集成到UIView类中,当内部的一些属性发生改变时,UIView将为这些改变提供动画 ...
- iOS - UIView
前言 NS_CLASS_AVAILABLE_IOS(2_0) @interface UIView : UIResponder <NSCoding, UIAppearance, UIAppeara ...
- UIView与CALayer的区别,很详细
研 究Core Animation已经有段时间了,关于Core Animation,网上没什么好的介绍.苹果网站上有篇专门的总结性介绍,但是似乎原理性的东西不多,看得人云山雾罩,感觉,写那篇东西的人, ...
- 【好程序员笔记分享】——UIView与CALayer详解
-iOS培训,iOS学习-------型技术博客.期待与您交流!------------ UIView与CALayer详解 研究Core Animation已经有段时间了,关于Core Animati ...
随机推荐
- go run/ go install/ go build / go get的区别
go run 运行当个.go文件 go install 在编译源代码之后还安装到指定的目录 go build 加上可编译的go源文件可以得到一个可执行文件 go get = git clone + g ...
- golang查看文档
大家都知道手册在开发中是多么重要,但是golang.org无法访问,如果不FQ的话可以通过下面的方法来查看手册 方法1 查看 fmt 包 go doc fmt 查看单个函数 Printf godoc ...
- mysql5.7 ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql5.7初次登录使用提示 ERROR 1820 (HY000): You must reset your password using ALTER USER statement before ...
- 181. Employees Earning More Than Their Managers
The Employee table holds all employees including their managers. Every employee has an Id, and there ...
- Apache配置基于IP的虚拟主机 Apache virtual host configuration is based on the IP
Step 1: 检查是否开启 httpd-vhosts.conf apache/conf/httpd.conf文件 # Virtual hosts Include conf/extra/httpd-v ...
- mysql 如何给root用户设置密码
用root 进入mysql后mysql>set password =password('你的密码');mysql>flush privileges;
- thinkphp之自动完成
1.自动完成 自动完成是ThinkPHP提供用来完成数据自动处理和过滤的方法,使用create方法创建数据对象的时候会自动完成数据处理. 因此,在ThinkPHP使用create方法来创建数据对象是 ...
- 链式前向星实现的堆优化dij求最短路模板
#include<cstdio> #include<string> #include<cstdlib> #include<cmath> #include ...
- PAT L3-002. 堆栈
树状数组,二分. 一堆数字,可以删除栈顶,压入数字,求中位数,可以线段树,也可以树状数组上二分. #include<map> #include<set> #include< ...
- python中join函数的用法
这个函数可以对字符串按照某种方式进行拼接,比如你要在三个字母中间都添加一个特定字符,就可以用这个函数实现 result = '*'.join(['A','B','C']) print(result) ...