gpt4 book ai didi

ios - 在进行 interactivePopGestureRecognizer 转换时禁用滚动

转载 作者:行者123 更新时间:2023-11-29 01:33:04 24 4
gpt4 key购买 nike

我已经实现了interactivePopGestureRecognizer。它过渡到上一页。但问题是,当转换发生时,如果当前 View Controller 中有一个 UIScrollView,它就会开始滚动。有什么办法可以预防吗?

我已在 RootViewcontroller 中添加了手势:

   self.appNavController = [[UINavigationController alloc] initWithRootViewController:controller];
self.appNavController.interactivePopGestureRecognizer.enabled = YES;
self.appNavController.interactivePopGestureRecognizer.delegate = (id<UIGestureRecognizerDelegate>)self;
[self.appNavController setNavigationBarHidden:YES];

我称之为:

-(void)viewDidAppear:(BOOL)animated{

[super viewDidAppear:animated];

APP_DELEGATE.rootViewController.appNavController.interactivePopGestureRecognizer.enabled = NO;

}

-(void)viewWillDisappear:(BOOL)animated{

[super viewWillDisappear:animated];

APP_DELEGATE.rootViewController.appNavController.interactivePopGestureRecognizer.enabled = YES;

}

最佳答案

我找到了解决方案。在正在滑动的 View Controller 中,我添加了以下内容:

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

self.scrollView.scrollEnabled = YES;
}

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

self.scrollView.scrollEnabled = NO;
}

它就像一个魅力。

关于ios - 在进行 interactivePopGestureRecognizer 转换时禁用滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33258228/

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