*Swift5, Xcode ver 12.1
View Controllerに配置したUIViewをOutlet接続した後、ViewDidLoad内に下記のコードを追加する。
View.layer.cornerRadius = 10
//影の色
View.layer.shadowColor = UIColor.black.cgColor
//影の透明度
View.layer.shadowOpacity = 1
//影のぼかし
View.layer.shadowRadius = 8
//影の方向
roundedView.layer.shadowOffset = CGSize(width: 4, height: 4)
コメント