iOS Guides | Samples

MonoTouch.UIKit.UIViewController Class

Base class for classes that manage the interaction between Model classes and View classes

See Also: UIViewController

Syntax

[MonoTouch.Foundation.Register("UIViewController", true)]
public class UIViewController : UIResponder, INSCoding, IUIAppearanceContainer, IUIContentContainer, IUIFocusEnvironment, IUITraitEnvironment, IEnumerable, IDisposable

See Also

Remarks

The UIViewController class is the base class of the View Controller hierarchy. View Controllers manage UIViews and other UIViewControllers. An iOS application has a single window, but many screens, each of which may contain several UIViews. Managing those screens is complex and requires responding to both user input and changes in the model (problem domain). This management and coordination is the job of the UIViewController.

A UIViewController has 3 major responsibilities:

  • Layout out its component UIViews. This includes sizing, responding to orientation changes, etc.
  • Restructure the display in response to input events or the state of Model classes
  • Translate user input into platform-neutral Model service requests

iOS provides a number of standard view controllers such as UINavigationController, UITabBarController, and UIPageViewController. In general, the application developer should prefer to use standard view controllers to create the overall display structure. Using standard view controllers provides consistent, standard behavior and makes it easier for the app to conform to the iOS Human Interface Guidelines.

Additionally, the application developer generally needs to implement one or more “Content View Controllers”. These are often derived directly from UIViewController or UITableViewController. Content View Controllers are where the application developer writes the custom code to satisfy the UIViewControllers responsibilities described previously. In applications that take advantage of Xamarin Studio’s Code Behind facilities for Apple’s Interface Builder, much of this custom code will be automatically generated by Xamarin Studio. Applications written using MonoTouch.Dialog do not generally need a custom-written Content View Controller, but may use one for architectural consistency.

A single View Controller may have many views and subcontrollers, but typically a single View Controller will have a single root view and be primarily concerned with controlling that one view or it will be primarily concerned with maintaining a collection of subcontrollers. In the following example, taken from the “Hello World iPhone” sample, a Content View Controller of type HelloWorld_iPhoneViewController is instantiated and set to be the UIWindow.RootViewController for the application’s window:

C# Example

public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
       // create a new window instance based on the screen size
       window = new UIWindow (UIScreen.MainScreen.Bounds);
          
       viewController = new HelloWorld_iPhoneViewController ("HelloWorld_iPhoneViewController", null);
       window.RootViewController = viewController;
       window.MakeKeyAndVisible ();
          
       return true;
}

By contrast, the following code taken from the "iOS Standard Controls" sample demonstrates how a UITableViewController uses an application-defined NavItemGroup to manage a series of other UIViewControllers. In this code, the second parameter to the NavItem constructor is the specific UIViewController subtype desired when that item is selected in the table:

C# Example

navGroup = new NavItemGroup ("Toolbars");
navItems.Add (navGroup);
navGroup.Items.Add (new NavItem ("Toolbar 1", "", typeof(Toolbar.Toolbar1_iPhone)));
navGroup.Items.Add (new NavItem ("Programmatic Toolbar", "", typeof(Toolbar.ProgrammaticToolbar_Controller)));
navGroup.Items.Add (new NavItem ("Toolbar Items", "", typeof(Toolbar.ToolbarItems)));
  
// create a table source from our nav items
tableSource = new NavItemTableSource (this.NavigationController, navItems);
  
// set the source on the table to our data source
base.TableView.Source = tableSource;

UIViewController and the MVC Architecture

The following illustration shows the classic relationship between Model, View, and Controller classes. The arrows indicate dependencies: the View depends on the Model class to provide data, the Controller depends on the Model class for information about what to display and depends on the View class to do the drawing. This diagram is idealized: there would be several classes in the Model, several Views, UIView can actually use UIResponder.NextResponder to determine their UIViewController, etc.

  • The Model class has no knowledge of the associated View and Controller classes. This allows the Model to evolve independently and greatly improves maintainability and portability
  • Event handlers are used between the areas of concern. This allows for strongly-typed EventArgs that only contain the data relating to that event. This improves maintainability by limiting the client object’s access to the event-provider’s scope.
  • The Controller reacts to events both from the View and from the Model. A UIViewController might, for instance, handle a UIControl.TouchUpInside input event by requesting the Model to convert between Celsius and Fahrenheit temperature units. Conversely it might respond to a Model “too hot” event by changing the display (making visible a warning icon or somesuch). The View updates its display in reaction to new data provided by Model events. View classes should be as passive as possible. One of the most common mistakes in non-maintainable software is a View class that acts as a Controller or that "reaches into" the Model for data rather than accepting values passed in as event arguments.

UIViewController, Interface Builder, Storyboards, and Nib files

XCode, Apple’s IDE, contains Interface Builder (“IB”), a tool that allows user interfaces to be created interactively and saved as “Nib” files (these are saved in XML format with the “.xib” extension). Xamarin Studio generates Code Behind classes for nib files and generally these will be subclasses of UIViewController. Starting with iOS 5, application developers can use “Storyboards” to visually specify navigation amongst individual UIViewControllers. For more on Storyboards, see Introduction to Storyboards.

Universal applications

Xamarin Studio fully supports universal applications that use a single UIViewController to control multiple UIViews customized for the iPad or the iPhone. As long as the UIViews used by the two devices share the same elements, they can share the same Outlets and Actions, as described in the "iPad + Universal (iPhone + iPad) Apps" guide.

It is not necessary for the iPhone and iPad versions to use the same UI elements, however. The application developer may wish to take advantage of the increased screen real-estate and larger set of controls available on the iPad. In such cases, the application developer should create separate UIViewControllers and load them appropriatel using code similar to the following, again taken from the “iPad + Universal (iPhone + iPad) Apps“ guide. The choice of the UIViewController to be loaded is determined at runtime based on a call to CurrentDevice.UserInterfaceIdiom.

C# Example

if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone) {
    homeScreen = new Screens.HomeScreen_iPhone();
} else {
    homeScreen = new Screens.HomeScreen_iPad();
}
window.RootViewController = homeScreen;

State Restoration

If you want to provide state restoration in your class, you need to manually add a method with the following signature to your class:

C# Example

[Adopts ("UIViewControllerRestoration")]
class MyUIViewController : UIViewController {

 [Export ("viewControllerWithRestorationIdentifierPath:")]
 static UIViewController FromIdentifierPath (string [] identifierComponents, NSCoder coder)
 {
    var sb = (UIStoryboard) coder.DecodeObject (UIStateRestoration.ViewControllerStoryboardKey);
    if (sb != null){
       var vc = (MyUIViewController) sb.InstantiateViewController ("MyViewController");
       vc.RestorationIdentifier = identifierComponents [identifierComponents.Length-1];
       vc.RestorationClass = Class.GetHandle (typeof (MyViewController));
    }
 }
}

UIViewController Subclasses

ClassUse-caseExample Image
UIActivityViewControllerChoose from a set of possible activities

UIPageViewControllerPresents content view controllers as a series of pages

UINavigationControllerPresents content view controllers one at a time, with a header and optional toolbar

UIImagePickerControllerA standard UINavigationController for selecting and taking photographs.

UIVideoEditorControllerA standard UINavigationController for reviewing and editing video and audio files.

UITabBarControllerTop-level controller that presents view controllers one at a time, selected by a toolbar along the bottom of the screen.

UIReferenceLibraryViewControllerA standard view controller that presents a term and it's dictionary definition.

UISplitViewControllerAn iPad-only view controller that presents side-by-side view controllers.

UICollectionViewControllerEfficiently displays a large number of cells, arranged in a flexible manner.

UITableViewControllerEfficiently displays a large number of cells, arranged vertically.

Adaptive Layout and Rotation

Starting with iOS 8 a series of idioms were introduced into iOS 8 to assist developers in creating applications and UIViewControllers that would work with different form factors, like both iPhone and iPad.

This replaces the pre-iOS8 design that focused on supporting two different form factors (iPhone or iPad) in a particular orientation as well as supporting the transitions from one interface orientation to the other.

New applications should take a number of variables into consideration when laying out the elements on their UI. These include the available size in the canvas, UserInterfaceIdiom (iPad or iPhone), the display scale, and both the vertical and horizontal size classes. The first one is the size of your main view, while the rest are stored in the UIViewController.TraitCollection.

Rotation is now considered a class size change. For example an iPhone held in portrait mode has a regular height and a compact width. When you switch it to landscape, it becomes a compact height and a regular width.

Applications can override UIViewController.TraitCollectionDidChange to react to changes to any of the user interface traits. This method will be invoked during rotations or changes to the user interface that affect the size class of the application.

The UIViewController.ViewWillTransitionToSize method is invoked when rotation takes place.

MVC, MVP, and MVVM

.NET developers will be familiar with Microsoft-promoted architectures that serve the same goal as MVC. Both Model-View-Presenter (MVP) and Model-View-ViewModel (MVVM) strive to maintain the separation between Model classes and display classes. Developers familiar with MVP will be used to Model data flowing through a coordinating Presenter object towards the View rather than MVC’s model in which Views directly subscribe to Model events. It is possible to do an MVP architecture in iOS by increasing the responsibilities of a UIViewController. The defining characteristic of MVVM is the use of databinding to ensure that View objects are reactive. iOS controls do not support databinding so MVVM is not possible. MVVM developers will be used to more of a "firewall" between View and Model objects than is available in MVC. MVVM developers should remind themselves to ensure their View objects are as reactive as possible and are not reaching in to the Model for data or taking over Controller responsibilities.

UIViewController and MonoTouch.Dialog

MonoTouch.Dialog (“MT.D”) allows complex UIs to be rapidly built using declarative statements. As opposed to applications built using Apple’s Interface Builder, most MT.D applications use the predefined DialogViewController and do not create their own subclass of UIViewController. For more information, refer to the MonoTouch.Dialog namespace documentation and the article Introduction to MonoTouch.Dialog.

Related content

Requirements

Namespace: MonoTouch.UIKit
Assembly: monotouch (in monotouch.dll)
Assembly Versions: 0.0.0.0

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

See Also: UIResponder

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.
A constructor used when creating a view controller using the information that is stored in the nib file.

Public Properties

AutomaticallyAdjustsScrollViewInsetsBoolean. Whether the UIViewController should automatically adjust its view insets in response to elements such as the status, navigation, and tab bars.
[read-only]
AutomaticallyForwardAppearanceAndRotationMethodsToChildViewControllersBoolean. Determines whether the containment events are automatically propagaged to nested view controllers.
[read-only]
BottomLayoutGuideIUILayoutSupport. The lower vertical extent of the onscreen content. Used by Auto Layout constraints. Read-only.
[read-only]
ChildViewControllersUIViewController[]. An array of UIViewControllers that are managed by this UIViewController.
[read-only]
override
ClassHandleIntPtr. The handle for this class.
ContentSizeForViewInPopoverSizeF. Default content size for popovers.
DefinesPresentationContextBoolean. Specifies whether this UIViewController’s UIViewController.View is shown when presenting another UIViewController.
[read-only]
DisablesAutomaticKeyboardDismissalBoolean. If true, input view will remain on-screen even when non-input control is tapped.
EdgesForExtendedLayoutUIRectEdge. Specifies how the UIViewController.ParentViewController should extend the layout of this UIKit.UIViewController.
[read-only]
EditButtonItemUIBarButtonItem. A UIBarButtonItem that toggles between statees "Edit" and "Done."
EditingBoolean. true if the UIViewController allows the application user to edit the UIView contents.
ExtendedLayoutIncludesOpaqueBarsBoolean. Whether the extended layout includes opaque bars.
[read-only]
ExtensionContextNSExtensionContext. Gets the NSExtensionContext for this view controller.
HidesBottomBarWhenPushedBoolean. Specifies whether the toolbar should be visible when this UIViewController is pushed onto a UINavigationController.
[read-only]
static
HierarchyInconsistencyExceptionNSString. Constant used to identify broken UIViewController hierarchies.
[read-only]
InterfaceOrientationUIInterfaceOrientation. The current orientation of the interface.
[read-only]
IsBeingDismissedBoolean. true if the current UIViewController is in the process of being dismissed.
[read-only]
IsBeingPresentedBoolean. true if the current UIViewController is in the process of being presented.
[read-only]
IsMovingFromParentViewControllerBoolean. true if the current UIViewController is in the process of being removed from its parent UIViewController.
[read-only]
IsMovingToParentViewControllerBoolean. true if the current UIViewController is in the process of being added to a parent UIViewController.
[read-only]
IsViewLoadedBoolean. A Boolean indicating whether the UIViewController.View is loaded into memory.
ModalInPopoverBoolean. true if this UIViewController should be presented modally by a UIPopoverController.
ModalPresentationCapturesStatusBarAppearanceBoolean. Whether the UIViewController, when presented modally but non-fullscreen, takes over control of the status bar.
ModalPresentationStyleUIModalPresentationStyle. The UIModalPresentationStyle to be used when presenting UIViewControllers.
ModalTransitionStyleUIModalTransitionStyle. The UIModalTransitionStyle to be used by UIViewController.PresentViewController.
[read-only]
ModalViewControllerUIViewController. Controller for the active presented view.
[read-only]
NavigationControllerUINavigationController. The nearest ancestor UINavigationController
[read-only]
NavigationItemUINavigationItem. A UINavigationItem that represents this UIViewController in its parent’s UINavigationController’s UINavigationController.UINavigationBar.
[read-only]
NibBundleNSBundle. The NSBundle from which this UIViewController was instantiated.
[read-only]
NibNameString. The name of the nib file from which this UIViewController was instantiated, or null.
[read-only]
ParentViewControllerUIViewController. The UIViewController that contains this UIViewController.
[read-only]
PopoverPresentationControllerUIPopoverPresentationController. Gets the nearest ancestor in the view hierarchy that is a UIPopoverPresentationController or null if there is none.
PreferredContentSizeSizeF. Gets the preferred size for the content of the container.
[read-only]
PreferredFocusedViewUIView. If not null, indicates the child UIView that should receive focus by default.
[read-only]
PreferredFocusEnvironmentsIUIFocusEnvironment[]. An array of IUIFocusEnvironments that are recursively searched by the system to find the default focused view.
[read-only]
PreferredStatusBarUpdateAnimationUIStatusBarAnimation. The preferred animation style for hiding and showing the status bar.
[read-only]
PresentationControllerUIPresentationController. Gets the nearest ancestor in the view hierarchy that is a UIPresentationController or null if there is none.
[read-only]
PresentedViewControllerUIViewController. The UIViewController that is being presented by this UIViewController or one of this’s ancestor UIViewControllers.
[read-only]
PresentingViewControllerUIViewController. The UIViewController that is presenting this UIViewController.
[read-only]
PreviewActionItemsIUIPreviewActionItem[]. Gets the array of IUIPreviewActionItem that are displayed when the user swipes upwards in 3D Touch Preview.
ProvidesPresentationContextTransitionStyleBoolean. true if this UIViewController overrides the transition style of the UIViewController that it presents.
RestorationClassClass. The class responsible for restoring application state.
RestorationIdentifierString. Specifies the instance of the UIViewController for restoration.
RestoresFocusAfterTransitionBoolean. Gets or sets whether this UIViewController restores focus after being transitioned to.
[read-only]
RotatingFooterViewUIView. The footer view that needs to be transitioned during an interface rotation
[read-only]
RotatingHeaderViewUIView. The header view that needs to be transitioned during an interface rotation.
[read-only]
SearchDisplayControllerUISearchDisplayController. The UISearchDisplayController, if any, associated with this UIViewController.
[read-only]
ShouldAutomaticallyForwardAppearanceMethodsBoolean. Whether appearance methods should be forwarded to child UIViewControllers.
[read-only]
ShouldAutomaticallyForwardRotationMethodsBoolean. Whether rotation methods should be forwarded to child UIViewControllers.
[read-only]
static
ShowDetailTargetDidChangeNotificationNSString. Notification constant for ShowDetailTargetDidChange
[read-only]
SplitViewControllerUISplitViewController. The nearest ancestor UISplitViewController or null.
[read-only]
StoryboardUIStoryboard. The UIStoryboard from which this UIViewController was created, or null.
[read-only]
TabBarControllerUITabBarController. The nearest ancestore UITabBarController or null.
TabBarItemUITabBarItem. A UITabBarItem that represents this UIViewController in its parent’s UITabBarController’s UITabBarController.UITabBar.
TitleString. A human-meaningful identifier of this UIViewController.
ToolbarItemsUIBarButtonItem[]. The array of UIBarButtonItems on a UINavigationController’s UINavigationController.Toolbar
[read-only]
TopLayoutGuideIUILayoutSupport. The highest vertical extent of onscreen content. Used by Auto Layout constraints. Read-only.
[read-only]
TraitCollectionUITraitCollection. Characteristics of the display, such as it's idiom, scale, and size class.
TransitioningDelegateUIViewControllerTransitioningDelegate. A delegate object that is responsible for producing IUIViewControllerAnimatedTransitionings for custom presentation.
ViewUIView. The view managed by this view controller.
[read-only]
ViewIfLoadedUIView. Returns the UIViewController.View if it has been instantiated; otherwise, returns null.
WantsFullScreenLayoutBoolean. true if the view should overlap the status bar.
WeakTransitioningDelegateNSObject. The delegate object used to provide controllers for transition animations and interactions.

Public Methods

Add(UIView)
This is an alias for UIView.AddSubview, but uses the Add pattern as it allows C# 3.0 constructs to add subviews after creating the object.
AddChildViewController(UIViewController)
Adds a UIViewController as a child.
AddKeyCommand(UIKeyCommand)
Adds command as a shortcut available to attached hardware keyboards.
ApplicationFinishedRestoringState()
Called when object decoding is complete during state restoration.
static
AttemptRotationToDeviceOrientation()
Programmatically triggers rotation of views.
BeginAppearanceTransition(Boolean, Boolean)
With UIViewController.EndAppearanceTransition, tells child UIViewControllers that their UIViews are about to either appear or disappear.
CanPerformUnwind(Selector, UIViewController, NSObject) : Boolean
Specifies whether this UIViewController supports the specific unwind segue
ChildViewControllerForStatusBarHidden() : UIViewController
When overridden, returns the UIViewController that determines whether the status bar is hidden or unhidden.
ChildViewControllerForStatusBarStyle() : UIViewController
When overridden, returns the UIViewController that determines the style of the status bar.
DecodeRestorableState(NSCoder)
With UIViewController.EncodeRestorableState, allows custom state restoration.
DidAnimateFirstHalfOfRotation(UIInterfaceOrientation)
Deprecated function called at end of first-part of two-step rotation animations.
DidMoveToParentViewController(UIViewController)
Called after this is added or removed from a parent UIViewController.
DidReceiveMemoryWarning()
Called when the system is running low on memory.
DidRotate(UIInterfaceOrientation)
Called after the UI has rotated.
DidUpdateFocus(UIFocusUpdateContext, UIFocusAnimationCoordinator)
Indicates that the focus changed as detailed in the context.
DismissModalViewControllerAnimated(Boolean)
Dismisses the modal UIViewController.
DismissMoviePlayerViewController()
Dismisses the MPMoviePlayerViewController.
DismissViewController(Boolean, NSAction)
Dismisses the presented UIViewController.
DismissViewControllerAsync(Boolean) : Task
Dismisses the presented .
EncodeRestorableState(NSCoder)
With UIViewController.DecodeRestorableState, allows custom state restoration.
EndAppearanceTransition()
With UIViewController.BeginAppearanceTransition, tells child UIViewControllers that their child views have just appeared or disappeared.
GetAllowedChildViewControllersForUnwinding(UIStoryboardUnwindSegueSource) : UIViewController[]
The array of child UIViewController objects that should be searched to determine if they are the unwind segue destination.
GetChildViewControllerContainingSegueSource(UIStoryboardUnwindSegueSource) : UIViewController
The child UIViewController that is the source of the unwind segue.
GetEnumerator() : IEnumerator
Returns an enumerator that lists all of the child UIViews
GetOverrideTraitCollectionForChildViewController(UIViewController) : UITraitCollection
Gets the UITraitCollection for the specified child view controller of this controller.
GetSegueForUnwinding(UIViewController, UIViewController, String) : UIStoryboardSegue
Defines the segue to be used between two UIViewControllers.
GetSizeForChildContentContainer(IUIContentContainer, SizeF) : SizeF
Gets the size of the content of the specified child IUIContentContainer by using the size of the parent container.
GetSupportedInterfaceOrientations() : UIInterfaceOrientationMask
The orientations supported by this UIViewController.
GetTargetViewControllerForAction(Selector, NSObject) : UIViewController
Gets the view controller for the specified action and sender.
GetViewControllerForUnwind(Selector, UIViewController, NSObject) : UIViewController
Used for searching child UIViewControllers for a specific unwind segue.
LoadView()
Initializes the UIViewController.View property.
LoadViewIfNeeded()
If necessary, synchronously loads the UIViewController.View from a Storyboard or NIB.
PerformSegue(String, NSObject)
Performs the specified UIStoryboardSegue.
PreferredContentSizeDidChangeForChildContentContainer(IUIContentContainer)
Notifies this controller that the preferred size for content for a specified child container has changed.
PreferredInterfaceOrientationForPresentation() : UIInterfaceOrientation
The orientation that best displays the content of this UIViewController.
PreferredStatusBarStyle() : UIStatusBarStyle
The preferred UIStatusBarStyle for this UIViewController.
PrefersStatusBarHidden() : Boolean
Whether this UIViewController prefers the status bar to be hidden.
static
PrepareForInterstitialAds()
Prepares the view controller to display interstitial ads.
PrepareForSegue(UIStoryboardSegue, NSObject)
Informs the application that a UIStoryboardSegue is about to be executed.
PresentModalViewController(UIViewController, Boolean)
Application developers should use UIViewController.PresentViewController instead of this deprecated method.
PresentMoviePlayerViewController(MPMoviePlayerViewController)
Displays a movie controller using the standard transition.
PresentViewController(UIViewController, Boolean, NSAction)
Presents a UIViewController. On iPhone and iTouch, presentation is always full screen, on iPad, the style is specified with UIViewController.ModalPresentationStyle.
PresentViewControllerAsync(UIViewController, Boolean) : Task
Presents a . On iPhone and iTouch, presentation is always full screen, on iPad, the style is specified with .
RegisterForPreviewingWithDelegate(IUIViewControllerPreviewingDelegate, UIView) : IUIViewControllerPreviewing
Registers this view controller for 3D Touch peek and pop operations.
RemoveFromParentViewController()
Removes this UIViewController from its UIViewController.ParentViewControllerUIViewController.
RemoveKeyCommand(UIKeyCommand)
Removes a previously-added hardware-keyboard accelerator.
SetEditing(Boolean, Boolean)
Turns editing mode on or off.
SetNeedsFocusUpdate()
When this is the active focus environment, requests a focus update, which can potentially change the UIView.PreferredFocusView. (See also UIView.UpdateFocusIfNeeded.)
SetNeedsStatusBarAppearanceUpdate()
Notifies the system that the attributes of the status bar have been changed.
SetOverrideTraitCollection(UITraitCollection, UIViewController)
Sets the UITraitCollection object for the specified child view controller of this controller.
SetToolbarItems(UIBarButtonItem[], Boolean)
Adds UIBarButtonItems to the UIToolbar
ShouldAutorotate() : Boolean
Turns auto-rotation on or off.
ShouldAutorotateToInterfaceOrientation(UIInterfaceOrientation) : Boolean
true if the UIViewController supports rotation to the specified UIInterfaceOrientation.
ShouldPerformSegue(String, NSObject) : Boolean
Whether the segue should be performed.
ShouldUpdateFocus(UIFocusUpdateContext) : Boolean
Called prior to the this either losing or receiving focus. If either focus environment returns false, the focus update is canceled.
ShowDetailViewController(UIViewController, NSObject)
Shows this view controller in a detail context.
ShowViewController(UIViewController, NSObject)
Shows this view controller.
SystemLayoutFittingSizeDidChangeForChildContentContainer(IUIContentContainer)
Notifies this container that auto layout resized a specified child container.
TraitCollectionDidChange(UITraitCollection)
Method invoked when the trait collection for the view controller changed.
Transition(UIViewController, UIViewController, Double, UIViewAnimationOptions, NSAction, UICompletionHandler)
Transitions from one child UIViewController to another.
TransitionAsync(UIViewController, UIViewController, Double, UIViewAnimationOptions, NSAction) : System.Threading.Tasks.Task<bool>
Transitions from one child to another.
UnregisterForPreviewingWithContext(IUIViewControllerPreviewing)
Stops previewing from handling 3D Touch peek and pop input.
Unwind(UIStoryboardSegue, UIViewController)
Called during an unwind segue on any UIViewController objects in the unwind path.
UpdateFocusIfNeeded()
If any focus environment has a pending update, this method forces an immediate focus update. Unlike UIViewController.SetNeedsFocusUpdate, this method may be called by any UIViewController, whether it currently contains focus or not.
UpdateViewConstraints()
Called when the UIViewController needs to recalculate its layout constraints.
ViewDidAppear(Boolean)
Called after the UIViewController.View is added to the view hierarchy.
ViewDidDisappear(Boolean)

This method is called after the UIViewthat is this UIViewController’s UIViewController.View property is removed from the display UIView hierarchy.

Application developers who override this method must call base.ViewDidDisappear() in their overridden method.

ViewDidLayoutSubviews()
Called after the UIViewController.View has laid out its subviews.
ViewDidLoad()
Called after the controller’s UIViewController.View is loaded into memory.
ViewDidUnload()
In iOS 6 and later, this method is never called. In prior versions it was called when the controller’s view was released from memory.
ViewWillAppear(Boolean)
Called prior to the UIViewController.View being added to the view hierarchy.
ViewWillDisappear(Boolean)

This method is called prior to the removal of the UIViewthat is this UIViewController’s UIViewController.View from the display UIView hierarchy.

Application developers may override this method to configure animations, resign first responder status (see UIResponder.ResignFirstResponder), or perform other tasks.

Application developers who override this method must call base.ViewWillDisappear() in their overridden method.

ViewWillLayoutSubviews()
Called before the UIViewController.View lays out its subviews.
ViewWillTransitionToSize(SizeF, IUIViewControllerTransitionCoordinator)
Notifies this that the size of it's view will change to the specified value, as coordinated by coordinator.
ViewWillUnload()
In iOS 6 and later, this method is never called. In prior versions it was called prior to the controller’s view was released from memory.
WillAnimateFirstHalfOfRotation(UIInterfaceOrientation, Double)
Deprecated method sent during the first half of a rotation. Application developers should instead use UIViewController.WillAnimateRotation.
WillAnimateRotation(UIInterfaceOrientation, Double)
Called prior to a one-step interface rotation.
WillAnimateSecondHalfOfRotation(UIInterfaceOrientation, Double)
Deprecated method sent during the second half of a rotation. Application developers should instead use UIViewController.WillAnimateRotation.
WillMoveToParentViewController(UIViewController)
Called prior to adding or removing this from a container UIViewController.
WillRotate(UIInterfaceOrientation, Double)
Called prior to a user interface rotation.
WillTransitionToTraitCollection(UITraitCollection, IUIViewControllerTransitionCoordinator)
Notifies this that its trait collection will change to traitCollection, as coordinated by coordinator.

Protected Methods

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