SWRevealViewController close rear view when tapping front view

前端 未结 9 1615
夕颜
夕颜 2020-12-09 04:18

I am using SWRevealViewController in order to implement a side nav menu in my app. I would like to make it so that the front view cannot be interacted with when

9条回答
  •  清歌不尽
    2020-12-09 05:10

    If you are using SWIFT, you can do something like this, in your frontViewController:

    override func viewDidLoad() {
        super.viewDidLoad()
    
        if self.revealViewController() != nil {
    
            self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())
            self.view.addGestureRecognizer(self.revealViewController().tapGestureRecognizer())
        }
    
    }
    

    Code works for TAP and PAN gesture.

提交回复
热议问题