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 ...
随机推荐
- struts2错误:The Struts dispatcher cannot be found.
struts2错误:The Struts dispatcher cannot be found. The Struts dispatcher cannot be found. This is usua ...
- 常用开源GIS项目
常用开源GIS项目 常用开源桌面GIS软件 QGIS 始于2002年5月,算得上是开源GIS平台中的后起之秀.界面友好,分析功能可与GRASS GIS相媲美.主页:http://www.qgi ...
- HDOJ/HDU 1328 IBM Minus One(水题一个,试试手)
Problem Description You may have heard of the book '2001 - A Space Odyssey' by Arthur C. Clarke, or ...
- JavaScript高级程序设计27.pdf
第11章 DOM扩展 W3C将一些已经成为事实标准的专有扩展标准化并写入规范当中.对DOM的两个主要扩展是SelectorsAPI(选择符API)和HTML5 选择符API 就是根据CSS选择符选择与 ...
- Microsoft Visual Studio 2013如何设置查找头文件的路径
- 【Java重构系列】重构31式之搬移方法
重构第二式:搬移方法 (Refactoring 2: Move Method) 毋容置疑,搬移方法(Move Method)应该是最常用的重构手段之一,正因为太常用而且较为简单,以至于很多人并不认为它 ...
- 校友信息管理&SNS互动平台之技术框架选择
前言.提纲及说明: 请移步:<校友信息管理&SNS互动平台之前言.目录及说明>(博客园地址:http://www.cnblogs.com/s6cn/p/3516876.html) ...
- PyDev+eclipse的编码问题
1.在代码的开始声明编码为utf-8
- PAT 1070. Mooncake (25)
Mooncake is a Chinese bakery product traditionally eaten during the Mid-Autumn Festival. Many types ...
- [C#] 常用工具类——应用程序属性信息访问类
using System; using System.Collections.Generic; using System.Text; using System.Reflection; namespac ...