Skip to content

Instantly share code, notes, and snippets.

@tylerlantern
Last active December 27, 2018 05:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tylerlantern/f715135b5edd883665eb869209c1f3f3 to your computer and use it in GitHub Desktop.
Save tylerlantern/f715135b5edd883665eb869209c1f3f3 to your computer and use it in GitHub Desktop.
public class BHMenuPresentation: UIPresentationController {
var bhDelegate : BHMenuPresentationDelegate?
public var dimmingView: UIView!
override init(presentedViewController: UIViewController, presenting presentingViewController: UIViewController?) {
super.init(presentedViewController: presentedViewController, presenting: presentingViewController)
setupDimmingView()
}
func setupDimmingView() {
dimmingView = UIView()
dimmingView.translatesAutoresizingMaskIntoConstraints = false
dimmingView.backgroundColor = UIColor.black
self.dimmingView.alpha = 0.0
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.dismissPresentationView(sender:)))
dimmingView.addGestureRecognizer(tapGesture)
}
@objc func dismissPresentationView(sender : UITapGestureRecognizer){
presentedViewController.dismiss(animated: true, completion: nil)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment