I am using good control SWRevealViewController
, but by some redone I want to track my own swipe gestures on my screen. So how can I switch off swipe options? I want to work only revealToggle
method that attached to my button. Did someone faced with this? Thank you
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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;
}
回答2:
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;
回答3:
I found this method:
for (UIGestureRecognizer *recognizer in self.view.gestureRecognizers) {
[self removeGestureRecognizer:tap];
}
回答4:
To stop the swipe in the SWRevealViewController:
In Swift 3.0
self.revealViewController().panGestureRecognizer().isEnabled = false