简体   繁体   English

垂直UIScrollView内部水平UIPageViewController不滚动

[英]vertical UIScrollView inside horizontal UIPageViewController not scrolling

I've got a UIPageViewController that allows for standard horizontal swiping between a basic set of ViewControllers. 我有一个UIPageViewController,它允许在一组基本的ViewControllers之间进行标准的水平滑动。

Those views' vertical length is quite long, requiring a UIScrollView to allow for vertical scrolling only. 这些视图的垂直长度非常长,需要UIScrollView才允许垂直滚动。 So, horizontal swipes to change the page, and vertical theoretically to scroll the page content. 所以,水平滑动改变页面,理论上垂直滚动页面内容。

Unfortunately the scrollview does not seem to scroll inside the PageViewController. 不幸的是,scrollview似乎没有在PageViewController内滚动。

I've set the scrollView contentSize which is a value larger than the container. 我已经设置了scrollView contentSize,它是一个大于容器的值。 I've enabled the delegate to be "self", and the scrollViewDidScroll method never gets called when swiping. 我已经将委托设置为“self”,并且在滑动时永远不会调用scrollViewDidScroll方法。

Is there something about the PageViewController and it's gesture recognizers that block the ScrollView's? 是否有关于PageViewController和它的手势识别器阻止ScrollView的东西?

I had the same issue. 我遇到过同样的问题。 Assume, that you are using Autolayout. 假设您正在使用Autolayout。 If so, explicitly set size like this: 如果是这样,明确设置大小如下:

CGRect screenRect = [[UIScreen mainScreen] bounds];
[self.mainScrollView setContentSize:CGSizeMake(screenRect.size.width, 568+300)];

This solves your problem UIGestureRecognizerDelegate : 这解决了你的问题UIGestureRecognizerDelegate

func gestureRecognizer(gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWithGestureRecognizer otherGestureRecognizer: UIGestureRecognizer) -> Bool {
    return true
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在水平UIPageViewController中实现垂直UIPageViewController - How to implement a vertical UIPageViewController inside a horizontal UIPageViewController 另一个UIPageViewController(垂直)(2轴)内的UIPageViewController(水平) - UIPageViewController (horizontal) inside another UIPageViewController (vertical) (2 axis) UIScrollview 在垂直和水平 ios 中滚动 - UIScrollview Scrolling in vertical and horizontal ios 用于水平和垂直滚动的UIScrollView策略 - UIScrollView strategies for horizontal and vertical scrolling UIPageViewController里面的UIScrollView页面滚动问题 - UIScrollView inside UIPageViewController page scrolling issue UIScrollView中的水平UIStackView不滚动 - Horizontal UIStackView inside UIScrollView not scrolling UITableViewCell内的UIScrollView-水平滚动 - UIScrollView inside a UITableViewCell - horizontal scrolling UIPageViewController内部的UIScrollView:UIScrollView滚动时无法滑动页面 - UIScrollView inside UIPageViewController: cannot swipe page while UIScrollView is scrolling 水平滚动UIScrollView与垂直平移手势 - Horizontal scrolling UIScrollView with vertical pan gesture 内部具有垂直UIScrollViews的水平UIScrollView - 如何在滚动外部水平视图时阻止滚动内部滚动视图? - Horizontal UIScrollView having vertical UIScrollViews inside - how to prevent scrolling of inner scroll views when scrolling outer horizontal view?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM