I am trying to darken the front view when I reveal the rear view. is there any way to do this?
swift please (I'm not very experienced with objc.. I know, I know- no need to preach..)
Thanks
In your MenuVC (the table View controller that lies behind and acts as a side menu). Add the following.
let darkView = UIView()
override func viewWillAppear(_ animated: Bool) {
darkView.addGestureRecognizer(revealViewController().tapGestureRecognizer())
darkView.backgroundColor = UIColor.black.withAlphaComponent(0.7)
darkView.frame = self.revealViewController().frontViewController.view.bounds
self.revealViewController().frontViewController.view.addSubview(darkView)
}
override func viewWillDisappear(_ animated: Bool) {
darkView.removeFromSuperview()
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With