Edytuj

Udostępnij za pośrednictwem


UIStateRestoration.ViewControllerStoryboardKey Property

Definition

Represents the value associated with the constant UIStateRestorationViewControllerStoryboardKey

[Foundation.Field("UIStateRestorationViewControllerStoryboardKey", "UIKit")]
public static Foundation.NSString ViewControllerStoryboardKey { get; }
member this.ViewControllerStoryboardKey : Foundation.NSString

Property Value

Attributes

Remarks

Application developers who wish to implement state restoration would use this method in the following manner:

[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));
      }
   }
}

Applies to