把layer常见图层属性总结了一下^-^欢迎大家讨论~~~~来吧 ,代码属性

#import "CZViewController.h"

@interface CZViewController ()

@property (nonatomic, strong) UIView *myView;
@property (nonatomic, strong) UIImageView *imageView; @end @implementation CZViewController - (UIImageView *)imageView
{
if (_imageView == nil) {
_imageView = [[UIImageView alloc] initWithFrame:CGRectMake(110, 100, 100, 100)];
_imageView.image = [UIImage imageNamed:@"头像1"]; _imageView.backgroundColor = [UIColor redColor]; [self.view addSubview:_imageView];
}
return _imageView;
} - (UIView *)myView
{
if (_myView == nil) {
_myView = [[UIView alloc] initWithFrame:CGRectMake(110, 100, 100, 100)];
_myView.backgroundColor = [UIColor redColor]; [self.view addSubview:_myView];
}
return _myView;
} - (void)viewDidLoad
{
[super viewDidLoad]; self.view.backgroundColor = [UIColor lightGrayColor]; [self imageView]; // 1. 阴影效果,在CA框架中不能直接使用UIKit的数据类型
//阴影颜色
self.imageView.layer.shadowColor = [UIColor yellowColor].CGColor;
//阴影偏移点
// self.myView.layer.shadowOffset = CGSizeMake(-10, 10);
//阴影半径
self.imageView.layer.shadowRadius = 10.0;
// 图层中的Opacity相当于view的alpha属性
self.imageView.layer.shadowOpacity = 1.0; // 2. 圆角半径
// 类似于clip,使用masksToBounds阴影效果无效
self.imageView.layer.masksToBounds = YES;
//图层的圆角半径
self.imageView.layer.cornerRadius = 50.0; // 3. 边框 颜色
self.imageView.layer.borderColor = [UIColor whiteColor].CGColor;
//边线宽度
self.imageView.layer.borderWidth = 5.0;
} - (void)viewLayerDemo
{
// 1. 阴影效果,在CA框架中不能直接使用UIKit的数据类型
self.myView.layer.shadowColor = [UIColor yellowColor].CGColor;
// self.myView.layer.shadowOffset = CGSizeMake(-10, 10);
self.myView.layer.shadowRadius = 10.0;
// 图层中的Opacity相当于view的alpha属性
self.myView.layer.shadowOpacity = 1.0; // 2. 圆角半径
self.myView.layer.cornerRadius = 50.0; // 3. 边框
self.myView.layer.borderColor = [UIColor whiteColor].CGColor;
self.myView.layer.borderWidth = 5.0;
} @end // 设置圆角半径
_imageView.layer.cornerRadius = 75;
// 阴影半径
// _imageView.layer.shadowRadius = 75;
// 阴影颜色
_imageView.layer.shadowColor = [UIColor yellowColor].CGColor;
// 阴影偏移位
_imageView.layer.shadowOffset = CGSizeMake( -10, 10);
// 阴影不透明度(0~1)默认是0
_imageView.layer.shadowOpacity = 1;
// 超出主层时添加蒙板遮盖
_imageView.layer.masksToBounds = YES;
// 裁剪超出边界的内容
// _imageView.clipsToBounds = YES;
// 边框线宽
_imageView.layer.borderWidth = 2;
// 边框颜色
_imageView.layer.borderColor = [UIColor blueColor].CGColor;
// CGRect imageVF = CGRectMake(-5, -2, _imageView.bounds.size.width + 10, _imageView.bounds.size.height + 10);
// 阴影(路径)或形状 系统会高点
// _imageView.layer.shadowPath = CGPathCreateWithRect(imageVF, NULL);

layer图层常见属性的更多相关文章

  1. UIView的常见属性

    UIView的常见属性: @interface UIView : UIResponder<NSCoding, UIAppearance, UIAppearanceContainer, UIDyn ...

  2. CALayer基本介绍与常见属性

    属性框架:QuartzCore CA: CoreAnimation -> 核心动画,所有的核心动画都是添加给layer的! 与UIView的区别: 1.layer负责内容的展示,不接受任何用户交 ...

  3. iOS图片折叠效果:Layer的contentsRect属性和渐变层

    http://www.cocoachina.com/ios/20150722/12622.html 作者:@吖了个峥 授权本站转载. 前言 此次文章,讲述的是Layer的一个属性contentsRec ...

  4. CoreGraphics-线段常见属性及渲染模式介绍

    线段常见属性: 1.线宽 2.线头样式 3.接头样式 4.颜色(包括描边颜色和填充颜色) override func draw(_ rect: CGRect) { // 获取图形上下文对象 let c ...

  5. 如果需要将UIView的4个角全部都为圆角,做法相当简单,只需设置其Layer的cornerRadius属性即可

    如果需要将UIView的4个角全部都为圆角,做法相当简单,只需设置其Layer的cornerRadius属性即可(项目需要使用QuartzCore框架).而若要指定某几个角(小于4)为圆角而别的不变时 ...

  6. Ext.Window 的常见属性

    Ext.Window 的常见属性:    plain:true,(默认不是)    resizable:false,(是否可以改变大小,默认可以)    maximizable:true,(是否增加最 ...

  7. UIView常见属性总结

    一 UIVIew 常见属性 .frame 位置和尺寸(以父控件的左上角为原点(,)) .center 中点 (以父控件的左上角为原点(,)) .bounds 位置和尺寸(以自己的左上角为原点 (,)) ...

  8. UISlider常见属性

    常见属性 self.mySlider.minimumValue = 0.0;   // 最小值 self.mySlider.maximumValue = 10;    // 最大值 self.mySl ...

  9. UIScrollView常见属性

    什么是UIScrollView •设备的屏幕大小是极其有限的,因此直接展示在用户眼前的内容也相当有限 • •当展示的内容较多,超出一个屏幕时,用户可通过滚动手势来查看屏幕以外的内容 • •普通的UIV ...

随机推荐

  1. redis入门配置

    简介: Redis是Nosql中比较出名的,分布式数据库缓存,提升相应的速度,降低对数据库的访问! Redis是一种高级key-value数据库.它跟memcached类似,不过数据可以持久化,(永久 ...

  2. rabbitmq技术

    Rabbitmq 初识rabbitmq RabbitMQ是流行的开源消息队列系统,用erlang语言开发.RabbitMQ是AMQP(高级消息队列协议)的标准实现.如果不熟悉AMQP,直接看Rabbi ...

  3. 2016年GitHub 排名前 100 的安卓、iOS项目简介(收藏)

    排名完全是根据 GitHub 搜索 Java 语言选择 (Best Match) 得到的结果, 然后过滤了跟 Android 不相关的项目, 所以排名并不具备任何官方效力, 仅供参考学习, 方便初学者 ...

  4. ubuntu eclipse 不能新建javaweb项目解决方案

    ubuntu下,通过sudo apt-get install eclipse 成功安装了eclipse,可它简洁的都让我不知如何新建web project.网上查了众多资料,终于找到了一系列简洁的方法 ...

  5. Mvc多级Views目录 asp.net mvc4 路由重写及 修改view 的寻找视图的规则

    一般我们在mvc开发过程中,都会碰到这样的问题.页面总是写在Views文件夹下,而且还只能一个Controller的页面只能写在相应的以Controller名命名的文件夹下.如果我们写到别处呢?那么肯 ...

  6. [转]PL/SQLDeveloper导入导出Oracle数据库方法

    原文地址:http://www.2cto.com/database/201405/305452.html 1.Oracle数据库导出步骤 1.1 Tools→Export User Objects.. ...

  7. 【UOJ #147】【NOIP 2015】斗地主

    http://uoj.ac/problem/147 搜索时先枚举三顺子,双顺子和单顺子,然后贪心带牌和成三成双成单出. #include<cstdio> #include<cstri ...

  8. asp.net mvc 数据查询赋值到文本框中

    大家做了很多文本框查询并且赋值回来 1.先是把数据对象查询结果后台,然后把对象赋值给对象在赋值回来前台页面 2.使用@html helerper 数据查询,使用 ViewContext.RouteDa ...

  9. JS 正则表达式中的特殊字符

    正则表达式中的特殊字符 字符 含意 \ 做为转意,即通常在"\"后面的字符不按原来意义解释,如/b/匹配字符"b",当b前面加了反斜杆后/\b/,转意为匹配一个 ...

  10. 【CodeForces 567E】President and Roads(最短路)

    Description Berland has n cities, the capital is located in city s, and the historic home town of th ...