I got 4 controllers inside my UIPageViewController. I start on the 1st controller. Then after notification received I open 4th controller programmatically. Like this:
[self setViewControllers:@[controller]
direction:UIPageViewControllerNavigationDirectionForward
animated:NO completion:^(BOOL finished)
{
if (finished) {
index.indexOfController = [controllers indexOfObject:controller];
[index centerTitle];
}
}];
When I start to swipe back, I can move only to 1st controller, not to 3rd. What is the reason? How to fix it?
Thanks.
Upd.
This is my before function
- (UIViewController*)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(UIViewController *)viewController
{
NSInteger index = [self.controllers indexOfObject:viewController];
index --;
if (index < 0)
return nil;
else
return self.controllers [index];
}
For some reason, class of view controller here is the class of the first controller. I thought, it should be 4th controller.