Advertisement
Guest User

Untitled

a guest
Aug 18th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. import UIKit
  2.  
  3.  
  4.  
  5. class LockScreenVC: UIViewController {
  6. lazy var detailContainer : UIView = {
  7. let v = UIView();
  8. v.backgroundColor = UIColor.black.withAlphaComponent(0.2)
  9. return v
  10. }()
  11.  
  12. lazy var detailButton: UIButton = {
  13. let btn = UIButton(frame: CGRect(x: 10, y: 10, width: 300, height: 150))
  14. btn.setTitle("Click Me", for: .normal)
  15. return btn
  16. }()
  17.  
  18. override func viewDidLoad() {
  19. super.viewDidLoad()
  20.  
  21. detailButton.addTarget(self, action: #selector(onDetailButtonPressed), for: .touchUpInside)
  22. detailContainer.addSubview(detailButton)
  23. detailContainer.isUserInteractionEnabled = true
  24. view.addSubview(detailContainer)
  25. }
  26.  
  27. @objc func onDetailButtonPressed() {
  28. print("You pressed the button!")
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement