把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. MATLAB中的set函数

    1.MATLAB给每种对象的每一个属性规定了一个名字,称为属性名,而属性名的取值成为属性值.例如,LineStyle是曲线对象的一个属性名,它的值决定着线型,取值可以是'-' .':'.'-.'.'- ...

  2. C# WinForm应用程序降低系统内存占用方法

    这里整理了一些网上关于Winform如何降低系统内存占用的资料,供参考: 1.使用性能测试工具dotTrace 3.0,它能够计算出你程序中那些代码占用内存较多2.强制垃圾回收3.创建完对象实例后,记 ...

  3. (Extjs)对于GridPanel的各种操作

    刚才做了个有点特殊的需求,在某窗口关闭时,要把Gridpanel中的选择行清空,因为如果不清空,直接双击,就不能即时更新出来我想要的内容. 答案是:Grid.getSelectionModel().c ...

  4. truncate与delete的区别

    TRUNCATE TABLE 在功能上与不带 WHERE 子句的 DELETE 语句相同:二者均删除表中的全部行.但 TRUNCATE TABLE 比 DELETE 速度快,且使用的系统和事务日志资源 ...

  5. [转]Null value was assigned to a property of primitive type setter of"原因及解决方法

    原文地址:http://blog.csdn.net/kevinzhangfei/article/details/6995316 在action请求数据的过程中报出"Null value wa ...

  6. TODO: 图片加载框架ImageLoader的实现

    1, 使用三级缓存策略 2, 使用builder模式设置ImagLoager的config

  7. C# String.Format格式说明

    C#格式化数值结果表 字符 说明 示例 输出 C 货币 string.Format("{0:C3}", 2) $2.000 D 十进制 string.Format("{0 ...

  8. AngularJs学习之一使用自定义的过滤器

    script: 参数item是由AngularJs提供的,是应当被过滤的对象集合.而showComplete是我们传入的参数. {{item.action}} 用ng-model创造一个名为showC ...

  9. js-JavaScript高级程序设计学习笔记7

    第十一章 DOM扩展 1.对DOM的两个主要的扩展是Selectors API(选择符API)和HTML5. 2.jQuery的核心就是通过CSS选择符查询DOM文档取得元素的引用,从而抛开了getE ...

  10. Leetcode 113. Path Sum II

    Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given su ...