I am making the following view controller(VC) structure.
[UINavigationViewController] -> [UIPageViewController] -> [UIViewControllers]
then, this VC should support portrait and landscape orientation.
A problem I have is raised at changing orientation to any sides.
you can see the problem.
red area is background color of child VC on UIPageViewController.
blue area is background color of UIPageViewController.
I guess child VC was not relayouted by UIPageViewController. I have figured it out for a long time. I finally ended up finding a work around to add the following overridden function to custom UIPageViewController.
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
[self setViewControllers:self.viewControllers
direction:UIPageViewControllerNavigationDirectionForward
animated:NO
completion:NULL];
}
Although moving a view to downside is showed as soon as finishing rotation. This code solves the problem roughly.
anyway, I really want to know any nice and natural solutions.
UPDATE
My app works well on iOS6. it may be iOS7 bug?
I have solved this problem to place the following SINGLE line of code in [viewDidLoaded] of custom UIPageViewController.
self.automaticallyAdjustsScrollViewInsets = NO;
I supposed that UIPageViewController has a scroll view, and if it is embedded in UINavigationController, it will lay out incorrectly since changing orientation.
Fortunately, my solution fitted in the problem.
@MirkoCatalano Thank you for your comments. these are very helpful to found out right solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With