Created
February 15, 2018 18:56
-
-
Save DonMag/1d25b5fbd19c6f00b5f029a31bdeaf04 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // Crash1hdViewController.swift | |
| // temp | |
| // | |
| // Created by Don Mag on 2/15/18. | |
| // Copyright © 2018 DonMag. All rights reserved. | |
| // | |
| import UIKit | |
| class Crash1hdViewController: UIViewController { | |
| let bkgView = UIView() | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| bkgView.translatesAutoresizingMaskIntoConstraints = false | |
| bkgView.backgroundColor = .red | |
| self.view.addSubview(bkgView) | |
| bkgView.topAnchor.constraint(equalTo: view.topAnchor, constant: 0.0).isActive = true | |
| bkgView.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: 0.0).isActive = true | |
| bkgView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 0.0).isActive = true | |
| bkgView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: 0.0).isActive = true | |
| let theLabel = UILabel() | |
| theLabel.translatesAutoresizingMaskIntoConstraints = false | |
| theLabel.backgroundColor = .yellow | |
| theLabel.numberOfLines = 0 | |
| theLabel.textAlignment = .center | |
| theLabel.text = "\nHello World!\n\n Tap anywhere to dismiss... \n" | |
| bkgView.addSubview(theLabel) | |
| theLabel.centerXAnchor.constraint(equalTo: bkgView.centerXAnchor, constant: 0.0).isActive = true | |
| theLabel.centerYAnchor.constraint(equalTo: bkgView.centerYAnchor, constant: 0.0).isActive = true | |
| // add a tap gesture | |
| let tapRecognizer = UITapGestureRecognizer() | |
| tapRecognizer.addTarget(self, action: #selector(onTap)) | |
| bkgView.addGestureRecognizer(tapRecognizer) | |
| } | |
| @objc func onTap() { | |
| bkgView.isHidden = true | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment