gpt4 book ai didi

ios - 如何在 iOS9 中禁用 interactivePopGestureRecognizer

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:10:30 24 4
gpt4 key购买 nike

我需要在我的应用程序中禁用 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”上遇到问题。

最佳答案

如果你想禁用全局 interactivePopGestureRecognizer,你可以在创建 navigationController 后禁用它,如下所示。

UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:rootVC];
nav.interactivePopGestureRecognizer.enabled=NO;

关于ios - 如何在 iOS9 中禁用 interactivePopGestureRecognizer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34449037/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com