Open mustafashaheen1 opened 4 years ago
Override touchesBegan is not needed! addGestureRecognizer is not needed!
Reading the documentation in the .h file: Just do it in the viewDidLoad of your main view controller:
class MainViewController: UITabBarController, SWRevealViewControllerDelegate {
override func viewDidLoad() {
super.viewDidLoad()
self.revealViewController().tapGestureRecognizer()
self.revealViewController().panGestureRecognizer()
// ...
And the rear view will be closed automatically.
I just tried this didn't work. I have a UINavigationController as front not UITabBarController and TableViewController as rear
It was an example. Just call revealViewController().tapGestureRecognizer in your main view controller.
I actually did that but still doesn't work. Just one thing the front page the whole view is google map where user taps. Can that be an issue? Here is my current code:
`import UIKit import SWRevealViewController class HomePageNavigationViewController: UINavigationController , SWRevealViewControllerDelegate{
override func viewDidLoad() {
super.viewDidLoad()
self.revealViewController().tapGestureRecognizer()
self.revealViewController().panGestureRecognizer()
// Do any additional setup after loading the view.
}`
I am using swift and xocde 12. And I am using TableViewController for the menu. I have tried following solutions but they didn't work.
`override func touchesBegan(_ touches: Set, with event: UIEvent?) {
if let touch = touches.first {
if self.revealViewController() != nil {
self.view.addGestureRecognizer(self.revealViewController().tapGestureRecognizer())
}
}
`if self.revealViewController() != nil {