extension UIView{
//圆角
@IBInspectable public
var cornerRadius: CGFloat {
get {
return layer.cornerRadius
}
set {
layer.cornerRadius = newValue
}
}
//阴影圆角
@IBInspectable public
var shadowRadius: CGFloat {
get {
return layer.shadowRadius
}
set {
layer.shadowRadius = newValue
}
}
//透明度
@IBInspectable public
var shadowOpacity: Float {
get {
return layer.shadowOpacity
}
set {
layer.shadowOpacity = newValue
}
}
//阴影颜色
@IBInspectable public
var shadowColor: UIColor? {
get {
return layer.shadowColor != nil ? UIColor(cgColor: layer.shadowColor!) : nil
}
set {
layer.shadowColor = newValue?.cgColor
}
}
//阴影偏移
@IBInspectable public
var shadowOffset:CGSize{
get{
return layer.shadowOffset
}
set{
layer.shadowOffset = newValue
}
}
}```
保存为UIViewHelper.swift