InteractivePopGestureRecognizer

InteractivePopGestureRecognizer

我已经实现了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;

}

最佳答案

我找到了解决方案。在刷卡的视图控制器中,我添加了以下内容:

- (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/

10-14 02:33