Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 在UIPageViewController内滚动UITextView_Objective C_Uitextview_Uigesturerecognizer_Uipageviewcontroller - Fatal编程技术网

Objective c 在UIPageViewController内滚动UITextView

Objective c 在UIPageViewController内滚动UITextView,objective-c,uitextview,uigesturerecognizer,uipageviewcontroller,Objective C,Uitextview,Uigesturerecognizer,Uipageviewcontroller,我有UIPageViewController,具有过渡样式滚动和垂直导航方向。在其中一个UIViewControllers中,我有一个UITextView。当我尝试在文本视图中滚动时,有时UIPageViewController会捕捉平移手势并尝试移动到下一个视图控制器。当用户滚动文本视图时,停止UIPageViewController接收触摸事件的解决方案是什么 我试图为文本视图设置exclusiveTouch=YES,但没有帮助 我找到了解决办法。当UITextView滚动时,可以禁用UIP

我有
UIPageViewController
,具有过渡样式滚动和垂直导航方向。在其中一个
UIViewControllers
中,我有一个
UITextView
。当我尝试在文本视图中滚动时,有时
UIPageViewController
会捕捉平移手势并尝试移动到下一个视图控制器。当用户滚动文本视图时,停止
UIPageViewController
接收触摸事件的解决方案是什么


我试图为文本视图设置
exclusiveTouch=YES
,但没有帮助

我找到了解决办法。当UITextView滚动时,可以禁用UIPageViewController平移

要禁用或启用UIPageViewController平移,请执行以下操作:

-(void)enablePanning:(BOOL) enable
{
    for (UIScrollView *view in self.pageViewController.view.subviews) {
        if ([view isKindOfClass:[UIScrollView class]]) {
            view.scrollEnabled = enable;
        }
    }
}
要知道UITextView何时滚动,我们可以使用UITextViewDelegate方法:

-(void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
{
    [self enablePanning:YES];
}

-(void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
     [self enablePanning:NO];
}