gpt4 book ai didi

ios - self.navigationController.interactivePopGestureRecognizer.enabled = NO;不适用于 iOS 8

转载 作者:可可西里 更新时间:2023-11-01 06:07:03 26 4
gpt4 key购买 nike

我想在滑动 View Controller 时禁用弹出手势,但以下几行在 iOS 8 中不起作用:

self.navigationController.interactivePopGestureRecognizer.enabled = NO;

提前致谢

最佳答案

在您希望禁用它的 View Controller 中,添加以下行:

- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];

if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.delegate = self;
}
}

- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.delegate = nil;
}

}

- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{
return NO;
}

关于ios - self.navigationController.interactivePopGestureRecognizer.enabled = NO;不适用于 iOS 8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26098392/

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