Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import UIKit
- class LockScreenVC: UIViewController {
- lazy var detailContainer : UIView = {
- let v = UIView();
- v.backgroundColor = UIColor.black.withAlphaComponent(0.2)
- return v
- }()
- lazy var detailButton: UIButton = {
- let btn = UIButton(frame: CGRect(x: 10, y: 10, width: 300, height: 150))
- btn.setTitle("Click Me", for: .normal)
- return btn
- }()
- override func viewDidLoad() {
- super.viewDidLoad()
- detailButton.addTarget(self, action: #selector(onDetailButtonPressed), for: .touchUpInside)
- detailContainer.addSubview(detailButton)
- detailContainer.isUserInteractionEnabled = true
- view.addSubview(detailContainer)
- }
- @objc func onDetailButtonPressed() {
- print("You pressed the button!")
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement