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 ...
随机推荐
- IIS服务器设置造成引用第三方权限不足问题
使用IIS部署站点,报以下错误: Exception Details: System.Security.SecurityException: That assembly does not allow ...
- Android性能测试
FPS和流畅度 FPS 1.dumpsys SurfaceFlinger –latency shell 脚本通过 dumpsys SurfaceFlinger --latency 数据计算 FPS 和 ...
- 图片上传,支持同步/异步、预览(MVC、uploadify异步提交、js预览、ajaxSubmit异步提交)兼容大部分浏览器,含代码
图片上传代码,支持同步/异步和图片的预览 主要用了两种方式,可兼容大部分浏览器. 第一种使用uploadify异步上传,上传后返回图片路径显示到页面. 每二种使用ajaxSubmit异步上传,为兼容I ...
- poj 1039 Pipe(几何基础)
Pipe Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 9932 Accepted: 3045 Description ...
- lfs遇到的一些问题--编制LFS
1.chroot后不要再打开新的终端了,没法用,还可能使系统崩溃.另外如果需要去睡觉,重启后要再次挂载并填充/dev和挂载虚拟内核文件系统,并再次运行chroot,可以将下列命令保存为脚本,重启后一次 ...
- C文件操作之写入字符串到指定文件并在屏幕显示
- 30分钟Git命令入门到放弃
git 现在的火爆程度非同一般,它被广泛地用在大型开源项目,团队开发,以及独立开发者,甚至学生之中. 初学者非常容易被各种命令,参数吓哭.但实际上刚上手你并不需要了解所有命令的用途.你可以从掌握一些简 ...
- Shell简介:什么是Shell,Shell命令的两种执行方式
Shell本身是一个用C语言编写的程序,它是用户使用Unix/Linux的桥梁,用户的大部分工作都是通过Shell完成的.Shell既是一种命令语言,又是一种程序设计语言.作为命令语言,它交互式地解释 ...
- c#复制图片到粘贴板
string fielN; private void button1_Click(object sender, EventArgs e) { OpenFileDialog saveFileDialog ...
- Character frequency
地址:http://www.codewars.com/kata/53e895e28f9e66a56900011a/train/python Write a function that takes a ...