UIPageViewController: how to get current page index and current visible controller?

UIPageViewController has the viewControllers array property. The currently visible viewController is always the first one in the viewControllers array.

Example:

Objective-C:

Swift:

The easiest way to get the current index is to have the itemIndex property in every content controller and just retrieve its value when necessary:

Objective-C:

Swift:

See the full UIPageViewController tutorial HERE or grab the example project from Github repo.

Leave a Reply

Your email address will not be published. Required fields are marked *


*