我需要在我的应用程序中禁用 interactivePopGestureRecognizer,我做到了
- (void)viewDidAppearBOOL)animated
{
[super viewDidAppear:animated];
// Disable iOS 7 back gesture
if ([self.navigationController respondsToSelectorselector(interactivePopGestureRecognizer)])
{
self.navigationController.interactivePopGestureRecognizer.enabled = NO;
self.navigationController.interactivePopGestureRecognizer.delegate = self;
}
}
- (void)viewWillDisappearBOOL)animated
{
[super viewWillDisappear:animated];
// Enable iOS 7 back gesture
if ([self.navigationController respondsToSelectorselector(interactivePopGestureRecognizer)])
{
self.navigationController.interactivePopGestureRecognizer.enabled = YES;
self.navigationController.interactivePopGestureRecognizer.delegate = nil;
}
}
- (BOOL)gestureRecognizerShouldBeginUIGestureRecognizer *)gestureRecognizer
{
return NO;
}
它适用于“iOS8”,我在“iOS9”上有一个问题。
如果你想全局禁用interactivePopGestureRecognizer,你可以在如下创建navigationController后禁用它。
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:rootVC];
nav.interactivePopGestureRecognizer.enabled=NO;
关于ios - 如何在 iOS9 中禁用 interactivePopGestureRecognizer 禁用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34449037/
欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) | Powered by Discuz! X3.4 |