我已经实施了interactivePopGestureRecognizer
。它转换到上一页。但问题是,当转换发生时,如果当前视图控制器中有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;
}
答案 0 :(得分:1)
我找到了解决方案。在正在刷卡的视图控制器中,我添加了以下内容:
- (void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
self.scrollView.scrollEnabled = YES;
}
- (void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
self.scrollView.scrollEnabled = NO;
}
它就像一个魅力。