M
M
mr_drinkens892016-09-29 14:23:05
Objective-C
mr_drinkens89, 2016-09-29 14:23:05

How to navigate to another page of UIPageViewController?

Good day.
Tell me, there is a UIPageViewController.
In the controller, I add a new page, and update the UIPageViewController with the new number of pages.
So, how do I "scroll" to this newly created page? Roughly speaking, how to make jump to page?
At the same time, it is necessary that this page was not the first (switch from the bottom), namely, the transition process took place.
That is, it turns out that if this new page is the last one, then it should scroll to this last page.
Thanks

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
vahan3x, 2016-10-06
@vahan3x

To do this, you must call the setViewControllers(_:direction:animated:completion:) method and pass it an array containing only one view controller, the one you want. And the entire stack of controllers that you want to show in your page view controller must be stored in a separate object that must implement the UIPageViewControllerDataSource protocol. You can read more about UIPageViewController in the documentation: https://developer.apple.com/reference/uikit/uipage...

B
briahas, 2016-10-06
@briahas

The first google link gives -

- (void)setViewControllers:(NSArray *)viewControllers 
                 direction:(UIPageViewControllerNavigationDirection)direction 
                  animated:(BOOL)animated 
                completion:(void (^)(BOOL finished))completion;`

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question