我需要在我的应用程序中禁用InteractivePopGestureRecognizer,我确实
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
// Disable iOS 7 back gesture
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)])
{
self.navigationController.interactivePopGestureRecognizer.enabled = NO;
self.navigationController.interactivePopGestureRecognizer.delegate = self;
}
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
// Enable iOS 7 back gesture
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)])
{
self.navigationController.interactivePopGestureRecognizer.enabled = YES;
self.navigationController.interactivePopGestureRecognizer.delegate = nil;
}
}
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{
return NO;
}
它适用于“iOS8”,“iOS9”上有问题。
最佳答案
如果要禁用globalPopGestureRecognizer全局,则可以在将NavigationController创建为波纹管之后将其禁用。
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:rootVC];
nav.interactivePopGestureRecognizer.enabled=NO;
关于ios - 如何在iOS9中禁用InteractivePopGestureRecognizer禁用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/34449037/