Search code examples
iosobjective-cuipageviewcontroller

Up to Down PageViewController


The following code works if I swipe page (image) back and forward. However, I wonder how could able to get from up to down or bottom to top?

In other words, images will stay at the bottom of the screen, when user swipes from top to bottom direction, then the second image will come, and so on so forth.

self.pageViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"PageViewController"];
self.pageViewController.dataSource = self;
self.pageViewController.delegate = self;
PageContentViewController *startingViewController = [self viewControllerAtIndex:0];
NSArray *viewControllers = @[startingViewController];
[self.pageViewController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];

Solution

  • You can create one programmatically and set it using the navigationOrientation: property

    UIPageViewController(transitionStyle: .scroll, navigationOrientation: .vertical, options: nil)

    or you can set it in a storyboard:

    Storyboard example