I've burnt hours on this. I've initialized UIPageViewController
with UIPageViewControllerNavigationOrientationHorizontal
, but for some reason viewControllerBeforeViewController
is called when user pans vertically.
Also, when this happens, there's no page flipping and didFinishAnimating:didFinishAnimating:previousViewControllers:transitionCompleted
isn't called at all. This means that the page view controller knows this is a vertical movement..
This is the initialization code -
- (void)initPageViewController
{
self.pageViewController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStylePageCurl
navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal
options:nil];
self.pageViewController.delegate = self;
self.pageViewController.dataSource = self;
[self addChildViewController:self.pageViewController];
[self.view addSubview:self.pageViewController.view];
// Set the page view controller's bounds using an inset rect so that self's view is visible around the edges of the pages.
self.pageViewController.view.frame = self.view.bounds;
[self.pageViewController didMoveToParentViewController:self];
// Leave only pan recognizers enabled, so buttons positioned inside a page would work.
for (UIGestureRecognizer *gr in self.pageViewController.gestureRecognizers)
{
if ([gr class] != [UIPanGestureRecognizer class])
gr.enabled = NO;
}
}
Any ideas?