My task: I need to implement a UIPageViewController
with TransitionStyle.pageCurl
. In portrait it should display a single page and double page in landscape. It should also be possible to pinch-to-zoom on both pages (when double page) and not just on one at a time.
My solution thus far: I have a UIViewController
that contains a UIScrollView
. I then add a UIPageViewController
view to my scroll view like this: self.scrollView.addSubview(self.pageViewController.view)
.
My problem: When I rotate the device func pageViewController(_ pageViewController: UIPageViewController, spineLocationFor orientation: UIInterfaceOrientation) -> UIPageViewController.SpineLocation
isn't called and therefore I am unable to change between double page and single page, or have I missed something?
I found this answer to a similar question: https://stackoverflow.com/a/34868768/2501509. My problem was that I did not retain the UIPageViewController
itself but only its view. By adding the page viewController to my viewController my issue was solved: self.addChild(self.pageViewController)
.