Vertical UIScrollView inside horizontal UIPageViewController not scrolling

I have a UIPageViewController that allows standard horizontal scrolling between the base set of ViewControllers.

The vertical length of these views is quite long, so the UIScrollView only allows vertical scrolling. Thus, horizontal clicks to change the page, and vertically theoretically to scroll through the contents of the page.

Unfortunately, scrollview doesn't seem to scroll inside the PageViewController.

I set scrollView contentSize whose value is greater than the container. I allowed the delegate to be “I,” and the scrollViewDidScroll method is never called when scrolling.

Is there anything about PageViewController and its gesture recognizers that block ScrollView?

+4
source share
2 answers

I had the same problem. Suppose you are using Autolayout. If yes, explicitly set the size as follows:

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

This solves your problem UIGestureRecognizerDelegate:

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

All Articles