Guest User

Untitled

a guest
Apr 24th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. import UIKit
  2.  
  3. class MainVC: UIViewController {
  4. var shadowView: UIView = {
  5. let view = UIView()
  6. view.backgroundColor = .darkGray
  7. view.translatesAutoresizingMaskIntoConstraints = false
  8. return view
  9. }()
  10. override func viewDidLoad() {
  11. super.viewDidLoad()
  12. self.view.backgroundColor = .white
  13. setupViews()
  14. }
  15. fileprivate func setupViews(){
  16. self.view.addSubview(shadowView)
  17. shadowView.widthAnchor.constraint(equalToConstant: 300).isActive = true
  18. shadowView.heightAnchor.constraint(equalToConstant: 300).isActive = true
  19. shadowView.centerXAnchor.constraint(equalTo: self.view.centerXAnchor).isActive = true
  20. shadowView.centerYAnchor.constraint(equalTo: self.view.centerYAnchor).isActive = true
  21. shadowView.layer.shadowRadius = 20
  22. shadowView.layer.shadowOpacity = 1
  23. shadowView.layer.shadowColor = UIColor.black.cgColor
  24. shadowView.layer.cornerRadius = 20
  25. }
  26. }
Add Comment
Please, Sign In to add comment