UIScrollview inside UIpageviewcontroller

I use UIPageViewControllerwith the curl effect to enable horizontal scroll b / w viewlers. However, the content size is greater than the view's.so height. I added it UIScrollViewto my controller to support vertical scrolling. I added this code to the viewcontroller to set the size of the scroll content -

-(void)viewDidLayoutSubviews
{
    [self.scrollView setContentSize:CGSizeMake(100, 900)];
}

The problem is that when the view controller is loaded in UIPageViewController, the scroll does not scroll at first when I try to scroll it, but it scrolls as soon as I load the next controller (by scrolling horizontally) and returns back to the controller at a glance. What am I doing wrong? Any help or suggestion would be appreciated.

+4
source share
1 answer

I solved the problem. Just add this snippet.

-(void)viewWillLayoutSubviews {
     [self.view layoutIfNeeded];
}

That's all!

+4
source

All Articles