UIViewController.View UIViewController.View Property

Definition

The view managed by this view controller.

[get: Foundation.Export("view", ObjCRuntime.ArgumentSemantic.Strong)]
[set: Foundation.Export("setView:", ObjCRuntime.ArgumentSemantic.Strong)]
public virtual UIKit.UIView View { get; set; }
member this.View : UIKit.UIView with get, set

Property Value

The UIView that this UIViewController manages.

This value can be null.

Remarks

A UIViewController contains a single UIView as the root of its view hierarchy. Such UIViews must only be referenced by a single UIViewController.

When accessed for the first time, this property will lazily initialize the UIView by calling the LoadView() function. To avoid lazy loading, the application developer should use the IsViewLoaded property, which will return false if the UIView has not been instantiated.

In iOS 6 and later, UIView's with active references are not scavenged in low-memory situations. In earlier versions, during low memory situations, this property may be unloaded and only re-initialized as display conditions warrant. In other words, object identity may not be preserved and the state of the UIView will be lost unless application code takes steps to preserve and restore it. (Prior to unloading, the ViewWillUnload() method will be called. That method and ViewDidLoad() are the appropriate places to take such steps.)

Applies to