//定义view的大小
let selfFrame =CGRect(x:0, y:0, width:kScreenW-75, height:kScreenW*0.93)
super .init(frame: selfFrame)
//定义view的背景颜色
backgroundColor = .white
//定义view的角度
layer.cornerRadius = 5
//定义view的阴影颜色
layer.shadowColor = UIColor.colorWidthHexString(hex: "#000000").cgColor
//阴影偏移量
layer.shadowOffset=CGSize(width:0, height:1)
//定义view的阴影宽度,模糊计算的半径
layer.shadowRadius = 10
//定义view的阴影透明度,注意:如果view没有设置背景色阴影也是不会显示的
layer.shadowOpacity = 0.1
}
这是从xcode里面摘取的内容,苹果的官方文档/** Shadow properties. **/
/* The color of the shadow. Defaults to opaque black. Colors created
* from patterns are currently NOT supported. Animatable. */
@property(nullable) CGColorRef shadowColor
/* The opacity of the shadow. Defaults to 0. Specifying a value outside the
* [0,1] range will give undefined results. Animatable. */
@property float shadowOpacity
/* The shadow offset. Defaults to (0, -3). Animatable. */
@property CGSize shadowOffset
/* The blur radius used to create the shadow. Defaults to 3. Animatable. */
@property CGFloat shadowRadius
/* When non-null this path defines the outline used to construct the
其实就是三个属性
后面这个是做的效果图
form http://blog.csdn.net/rhljiayou/article/details/10178723
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)