阴影设置为layer属性上,代码如下
layer.shadowColor = UIColor(red: 0.088, green: 0.12, blue: 0.225, alpha: 0.06).cgColor
layer.shadowOpacity = 1
layer.cornerRadius = 16
layer.shadowRadius = 12
layer.shadowOffset = CGSize(width: 0, height: 4)
//如果layer.masksToBounds设置为true,则会没有效果,需要设置为false
layer.masksToBounds = false
网友评论