UIViewController.LoadViewIfNeeded Метод
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
При необходимости синхронно загружает из View раскадровки или NIB.
[Foundation.Export("loadViewIfNeeded")]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 9, 0, ObjCRuntime.PlatformArchitecture.All, null)]
public virtual void LoadViewIfNeeded ();
abstract member LoadViewIfNeeded : unit -> unit
override this.LoadViewIfNeeded : unit -> unit
- Атрибуты
Комментарии
Этот метод можно использовать, чтобы убедиться, что View объект был создан, если UIViewController имеет связанную раскадровку или NIB. (См. также сведения об ViewIfLoaded.)
var newVC = UIStoryboard.FromName("Main", NSBundle.MainBundle).InstantiateInitialViewController();
if (newVC.ViewIfLoaded == null)
{
//This call blocks until the View is instantiated
newVC.LoadViewIfNeeded();
}