SWRevealViewController disable interaction with front view(map) when left view are revealed swift 3

633 Views Asked by At

I have already implemented the delegate line, but methods doesnt get called. My view is a MAP, and the gesture on map doesnt work either.

    override func viewDidLoad() {
    super.viewDidLoad()

    if self.revealViewController() != nil {
        menuBtn.target = self.revealViewController()
        self.revealViewController().delegate = self
        menuBtn.action = #selector(SWRevealViewController.revealToggle(_:))
        self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())
    }
}

    func revealController(revealController: SWRevealViewController, willMoveToPosition position: FrontViewPosition)
{
    if revealController.frontViewPosition == FrontViewPosition.left     // if it not statisfy try this --> if revealController.frontViewPosition == FrontViewPosition.Left
    {
        self.Map.isUserInteractionEnabled = false
    }
    else
    {
        self.Map.isUserInteractionEnabled = true
    }
}

func revealController(revealController: SWRevealViewController, didMoveToPosition position: FrontViewPosition)
{
    if revealController.frontViewPosition == FrontViewPosition.left     // if it not statisfy try this --> if revealController.frontViewPosition == FrontViewPosition.Left
    {
        self.Map.isUserInteractionEnabled = false
    }
    else
    {
        self.Map.isUserInteractionEnabled = true
    }
}

none of these funcs get called... there are any change on new lib?

1

There are 1 best solutions below

0
On BEST ANSWER

had to implement:

    override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)

    self.revealViewController().view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())
    self.revealViewController().frontViewController.revealViewController().tapGestureRecognizer()
    self.revealViewController().frontViewController.view.isUserInteractionEnabled = false
}

override func viewWillDisappear(_ animated: Bool) {
    super.viewWillDisappear(animated)

    self.revealViewController().frontViewController.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())
    self.revealViewController().frontViewController.view.isUserInteractionEnabled = true
}

on my menu view controller