The UIViewControllerRestoration protocol should be adopted by classes that act as “restoration classes” for view controllers during the state restoration process. The method in this protocol should be used to create the view controller, if it does not yet exist, or return an existing view controller object, if one does exist.Asks the receiver to provide the view controller that corresponds to the specified identifier information. (required)The following keys are used when reading and writing state restoration data.
Class Method Summary (collapse)
Asks the receiver to provide the view controller that corresponds to the specified identifier information.
Class Method Details
+ () viewControllerWithRestorationIdentifierPath(identifierComponents, coder:coder)
Asks the receiver to provide the view controller that corresponds to the specified identifier information. (required) Your implementation of this method should create (or find) the corresponding view controller object and return it. If your restoration class determines that it does not make sense to display this view controller now, it may return nil from this method to prevent that view controller (and its children) from being added to your interface during the restoration process. You use the strings in the identifierComponents parameter to identify the view controller being requested. The view controllers in your app form a hierarchy. At the root of this hierarchy is the window’s root view controller, which itself may present or embed other view controllers. Those presented or embedded view controllers may themselves present and embed other view controllers. The result is a hierarchy of view controller relationships, with each presented or embedded view controller becoming a child of the view controller that presented or embedded it. The strings in the identifierComponents array identify the path through this hierarchy from the root view controller to the desired view controller.It is not always necessary to create a new view controller object in your implementation of this method. You can also return an existing view controller object that was created by another means. For example, if the view controller had already been loaded from a storyboard file, you would return that object rather than create a new one. Your implementation of this method may use any data in the provided coder to assist in the restoration process. However, you do not need to restore the entire state of the view controller at this point. During a later pass, view controllers that define a decodeRestorableStateWithCoder: method are given a chance to restore their state form the same coder object.Note: If you return an object whose class does not match the class of the originally preserved object, or whose class is not a direct subclass of the original, the restoration system does not call the decodeRestorableStateWithCoder: method of the view controller.