iOS Guides | Samples

MonoTouch.UIKit.UIPageViewController Class

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

See Also: UIPageViewController

Syntax

[MonoTouch.Foundation.Register("UIPageViewController", true)]
[MonoTouch.ObjCRuntime.Introduced(MonoTouch.ObjCRuntime.PlatformName.iOS, 5, 0, MonoTouch.ObjCRuntime.PlatformArchitecture.None, null)]
public class UIPageViewController : UIViewController, IDisposable

Remarks

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

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

To use a UIPageViewController, application developers create some number of content UIViewControllers that are logically connected by the UIPageViewControllerDataSource.GetNextViewController and UIPageViewControllerDataSource.GetPreviousViewController methods of the UIPageViewControllerDataSource delegate object and assign the UIPageViewControllerDataSource to the UIPageViewController.DataSource property of the 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: MonoTouch.UIKit
Assembly: monotouch (in monotouch.dll)
Assembly Versions: 0.0.0.0

The members of MonoTouch.UIKit.UIPageViewController are listed below.

See Also: UIViewController

Public Constructors

Default constructor that initializes a new instance of this class with no parameters.
A constructor that initializes the object from the data stored in the unarchiver object.
Constructor to call on derived classes to skip initialization and merely allocate the object.
A constructor used when creating managed representations of unmanaged objects; Called by the runtime.
Creates an initialized UIPageViewController object that has the NIB named nibName in a NSBundle.
Creates an initialized noTouch.UIKit.UIPageViewController object by using a UIPageViewControllerTransitionStyle of transition between pages, a UIPageViewControllerNavigationOrientation orientation of navigation, and options.
Creates an initialized noTouch.UIKit.UIPageViewController object by using a UIPageViewControllerTransitionStyle of transition between pages, a UIPageViewControllerNavigationOrientation orientation of navigation, and a spineLocation.

Public Properties

[read-only]
override
ClassHandleIntPtr. The handle for this class.
DataSourceUIPageViewControllerDataSource. The source for data for this UIPageViewController.
DelegateUIPageViewControllerDelegate. An instance of the MonoTouch.UIKit.UIPageViewControllerDelegate model class which acts as the class delegate.
DoubleSidedBoolean. Whether content appears on the backs of pages. The default is false.
[read-only]
GestureRecognizersUIGestureRecognizer[]. The set of UIGestureRecognizers used to handle user interaction. Read-only.
GetNextViewControllerUIPageViewGetViewController. Delegate invoked by the object to get a value.
GetPreferredInterfaceOrientationForPresentationFunc<UIPageViewController, UIInterfaceOrientation>. Delegate invoked by the object to get a value.
GetPresentationCountUIPageViewGetNumber. Delegate invoked by the object to get a value.
GetPresentationIndexUIPageViewGetNumber. Delegate invoked by the object to get a value.
GetPreviousViewControllerUIPageViewGetViewController. Delegate invoked by the object to get a value.
GetSpineLocationUIPageViewSpineLocationCallback. Delegate invoked by the object to get a value.
[read-only]
NavigationOrientationUIPageViewControllerNavigationOrientation. The direction along which navigation occurs. Read-only.
[read-only]
static
OptionSpineLocationKeyNSString. Represents the value associated with the constant UIPageViewControllerOptionSpineLocationKey
[read-only]
SpineLocationUIPageViewControllerSpineLocation. The location of the spine. Read-only.
SupportedInterfaceOrientationsFunc<UIPageViewController, UIInterfaceOrientationMask>. Delegate invoked by the object to get a value.
[read-only]
TransitionStyleUIPageViewControllerTransitionStyle. The style used to transition between UIViewControllers. Read-only.
[read-only]
ViewControllersUIViewController[]. The UIViewControllers to be displayed.
WeakDataSourceNSObject. The data source for this.
WeakDelegateNSObject. An object that can respond to the delegate protocol for this type

Public Methods

Protected Methods

override
Dispose(Boolean)
Releases the resources used by the UIPageViewController object.

Public Events

DidFinishAnimatingEvent raised by the object.
WillTransitionEvent raised by the object.