UIKit.UIPageViewController Class
Allows the application user to navigation between UIKit.UIViewControllers using page-curl and page-scroll transitions.

See Also: UIPageViewController Members

Syntax

[Foundation.Register("UIPageViewController", true)]
[ObjCRuntime.Availability(Introduced=ObjCRuntime.Platform.iOS_5_0)]
public class UIPageViewController : UIViewController

Remarks

The UIKit.UIPageViewController presents its UIPageViewController.ViewControllers one or two at a time, transitioning between them using either scrolling or page-curl animations.

Like the UIKit.UINavigationController and UIKit.UITabBarController, the UIKit.UIPageViewController serves as a container for other UIKit.UIViewControllers. It has no visual ornamentation beyond its UIPageViewController.TransitionStyle animation. The following image shows a UIKit.UIPageViewController displaying 2 pages, sitting inside a parent UIKit.UIViewController that has a brown background.

To use a UIKit.UIPageViewController, application developers create some number of content UIKit.UIViewControllers that are logically connected by the UIPageViewControllerDataSource.GetNextViewController and UIPageViewControllerDataSource.GetPreviousViewController methods of the UIKit.UIPageViewControllerDataSource delegate object and assign the UIKit.UIPageViewControllerDataSource to the UIPageViewController.DataSource property of the UIKit.UIPageViewController, as shown in the following example:

C# Example

//Create the UIPageViewController and it's basic style
var pvController = new UIPageViewController(UIPageViewControllerTransitionStyle.PageCurl, UIPageViewControllerNavigationOrientation.Horizontal);
//Specify the data source for the pages
pvController.DataSource = new PageDataSource(pages);
pvController.View.Frame = View.Bounds;
//Set the initial content (first pages)
pvController.SetViewControllers(new UIViewController[] { pages[0], pages[1] }, UIPageViewControllerNavigationDirection.Forward, false, s => {});
//...etc...

public class PageDataSource : UIPageViewControllerDataSource
{
	List<PageController> pages; 

	public PageDataSource(List<PageController> pages)
	{
		this.pages = pages;
	}

	override public UIViewController GetPreviousViewController(UIPageViewController pageViewController, UIViewController referenceViewController)
	{
		var currentPage = referenceViewController as PageController;
		if(currentPage.Index == 0)
		{
			return pages[pages.Count - 1];
		}
		else
		{
			return pages[currentPage.Index - 1];
		}
	}

	override public UIViewController GetNextViewController(UIPageViewController pageViewController, UIViewController referenceViewController)
	{
		var currentPage = referenceViewController as PageController;
		return pages[ (currentPage.Index+1) % pages.Count];
	}
}          
          

Related content

Requirements

Namespace: UIKit
Assembly: Xamarin.iOS (in Xamarin.iOS.dll)
Assembly Versions: 0.0.0.0