当左视图显示为swift 3时,SWRevealViewController禁用与前视图(地图)的交互

时间:2017-01-03 03:20:33

标签: ios dictionary swrevealviewcontroller

我已经实现了委托行,但是没有调用方法。 我的视图是MAP,地图上的手势也不起作用。

    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
    }
}

这些func都没有被调用......新的lib有什么变化吗?

1 个答案:

答案 0 :(得分:4)

必须实施:

    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
}
我的菜单视图控制器上的