SWRevealViewController how to remove swipe gesture

给你一囗甜甜゛ 提交于 2019-12-05 01:55:55

In order to disable the swipe gesture you can simple do:

self.revealViewController.panGestureRecognizer.enabled=NO;

For example:

-(void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    self.revealViewController.panGestureRecognizer.enabled=NO;
}

-(void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    self.revealViewController.panGestureRecognizer.enabled=YES;
}

In your viewDidLoad method,type the below code where you don't want to enable the swipe gesture:

SWRevealViewController *reveal = self.revealViewController;
reveal.panGestureRecognizer.enabled = NO;

I found this method:

for (UIGestureRecognizer *recognizer in self.view.gestureRecognizers) {
    [self removeGestureRecognizer:tap];
}

To stop the swipe in the SWRevealViewController:

In Swift 3.0

self.revealViewController().panGestureRecognizer().isEnabled = false
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!