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