iOS Swift 圆角阴影效果
let yellowView = UIView.init(frame: CGRect(x: 30, y: 100, width: 200, height: 200))
view.addSubview(yellowView)
yellowView.backgroundColor = UIColor.yellow
// 阴影不透明度
yellowView.layer.shadowOpacity = 1.0
// 阴影颜色
yellowView.layer.shadowColor = UIColor.red.cgColor
// 阴影的半径
yellowView.layer.shadowRadius = 20.0
// 阴影偏移量:正数向右 向下,负数向左向上
yellowView.layer.shadowOffset = CGSize(width: 0, height: 0)
// 圆角半径
yellowView.layer.cornerRadius = yellowView.bounds.width / 2
网友评论