⚠️⚠️⚠️ 设置阴影的视图,需要设置背景颜色
- Example
extension UIView {
// - Parameters
// - shadowColor: 阴影颜色
// - shadowOffset: 阴影偏移量
// - shadowRadius: 阴影半径
// - shadowOpacity: 阴影透明度
func addShadow(shadowColor: CGColor, shadowOffset: CGSize, shadowRadius: CGFloat, shadowOpacity: Float ) {
self.layer.shadowColor = shadowColor
self.layer.shadowOffset = shadowOffset
self.layer.shadowRadius = shadowRadius
self.layer.shadowOpacity = shadowOpacity
}
}
网友评论