iOS Core Animation学习总结(1)--CALayer常用属性
//创建image view
UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"curry.jpg"]];
imgView.frame = CGRectMake(, , , );
[self.view addSubview:imgView]; //设置阴影的颜色为灰色
imgView.layer.shadowColor = [UIColor grayColor].CGColor;
//阴影的偏移大小,右下角偏移
imgView.layer.shadowOffset = CGSizeMake(, );
//0.5表示半透明
imgView.layer.shadowOpacity = 0.5;

//设置圆角半径为10
imgView.layer.cornerRadius = 10;
imgView.layer.masksToBounds = YES;

3.设置边框
//设置黄色边框大小为5像素
imgView.layer.borderWidth = 5;
imgView.layer.borderColor = [UIColor yellowColor].CGColor;
效果:

4.旋转
//设置旋转效果
imgView.layer.transform = CATransform3DMakeRotation(M_PI_4, 1, 1, 1);//顺时针旋转45°
效果:

//设置缩放效果
imgView.layer.transform = CATransform3DMakeScale(0.5, 1, 0);//x轴缩小0.5倍
效果:

CALayer *layer = [CALayer layer];
layer.backgroundColor = [UIColor blackColor].CGColor;
layer.bounds = CGRectMake(0, 0, 100, 100); layer.position = CGPointMake(200, 200);
layer.anchorPoint = CGPointMake(0.5, 0.5);
layer.cornerRadius = 10;
layer.masksToBounds = YES;
layer.contents = CFBridgingRelease([UIImage imageNamed:@"curry.jpg"].CGImage); [self.view.layer addSublayer:layer];
iOS Core Animation学习总结(1)--CALayer常用属性的更多相关文章
- iOS Core Animation学习总结(3)--动画的基本类型
一. CABasicAnimation (基础动画) 移位: CABasicAnimation *animation = [CABasicAnimation animation]; //keyPath ...
- iOS Core Animation学习总结(2)--实现自定义图层
一. 创建图层继承于CALayer,并在子类实现drawInContext方法 @interface CTLayer : CALayer @end @implementation CTLayer -( ...
- 转 iOS Core Animation 动画 入门学习(一)基础
iOS Core Animation 动画 入门学习(一)基础 reference:https://developer.apple.com/library/ios/documentation/Coco ...
- iOS——Core Animation 知识摘抄(三)
原文地址:http://www.cocoachina.com/ios/20150105/10827.html CAShapeLayer CAShapeLayer是一个通过矢量图形而不是bitmap来绘 ...
- iOS Core Animation 简明系列教程
iOS Core Animation 简明系列教程 看到无数的CA教程,都非常的难懂,各种事务各种图层关系看的人头大.自己就想用通俗的语言翻译给大家听,尽可能准确表达,如果哪里有问题,请您指出我会尽 ...
- Core Animation学习总结
文件夹: The Layer Beneath The Layer Tree(图层树) The Backing Image(寄宿层) Layer Geometry(图层几何学) Visual Effec ...
- iOS - Core Animation 核心动画
1.UIView 动画 具体讲解见 iOS - UIView 动画 2.UIImageView 动画 具体讲解见 iOS - UIImageView 动画 3.CADisplayLink 定时器 具体 ...
- iOS——Core Animation 知识摘抄(四)
原文地址http://www.cocoachina.com/ios/20150106/10840.html 延迟解压 一旦图片文件被加载就必须要进行解码,解码过程是一个相当复杂的任务,需要消耗非常长的 ...
- IOS Core Animation Advanced Techniques的学习笔记(五)
第六章:Specialized Layers 类别 用途 CAEmitterLayer 用于实现基于Core Animation粒子发射系统.发射器层对象控制粒子的生成和起源 CAGradient ...
随机推荐
- [PeterDLax著泛函分析习题参考解答]第1章 线性空间
1. 证明定理 1. 2. 验证上述结论. 3. 证明定理 3. 4. 证明定理 4. 证明: 由 $$\bex x=\sum_{k=1}^{n-1}a_k\cdot \sum_{j=1}^{n-1} ...
- HDU-1598 find the most comfortable road
find the most comfortable road Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ...
- web测试方面的知识
web测试 软件测试体系架构设计 一.体系架构 1.C/S:客户端+服务器端,如QQ.单机版记事本.office等,所用语言:VB.C++.C.C#.JAVA.PB.D…等数组语言,C和S都是自己测, ...
- Linux下Chrome浏览器的BUG
“我胡汉三又回来了”,好久没出现在博客园了,准备考试什么的最烦躁了,今天又重新整了下我的Ubuntu,结果发现了一个Chrome浏览器的Bug,但是与其说它是个Bug,还不如说它是个Joke. 好吧, ...
- HW4.25
public class Solution { public static void main(String[] args) { double sum; for(int i = 10000; i &l ...
- add-apt-repository cloud-archive:liberty
apt-get update && apt-get upgrade;
- Java反射机制学习
Java 反射是Java语言的一个很重要的特征,它使得Java具体了“动态性”. 在Java运行时环境中,对于任意一个类,能否知道这个类有哪些属性和方法?对于任意一个对象,能否调用它的任意一个方法?答 ...
- try与finally返回结果执行先后详解
先看一段代码: @Test public void test1(){ System.out.println(testf1()); } int testf1() { int x = 1; try { r ...
- EasyUI-在行内进行表格的增删改操作
第一篇笔记中记录了如何实现表格的增删改,那个是点击之后跳出来一个对话框然后进行的,这里是在表格本身上进行的操作,也很简单,但是这里发现一个版本问题,也可以说是兼容性问题. 1.首先我们看引用的js和c ...
- C++访问sqlite3实践
Sqlite确实是一个比较好的本地数据库,从接触它的时候就喜欢上了它,它可以在很多情况下简化应用.不过以前都是在Java里面使用,或者Linux C下使用的,现在有个项目(C++)可能我会用到sqli ...