Asks the receiver to provide the view controller that corresponds to the specified identifier information.
- iOS 6.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
An array of
NSStringobjects corresponding to the restoration identifiers of the desired view controller and all of its ancestors in the view controller hierarchy. The last value in the array is the restoration identifier of the desired view controller. Earlier entries represent the restoration identifiers of its ancestors.
The keyed archiver containing the app’s saved state information.
The view controller object to use or
nil if you do not want to restore this view controller now.
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
identifier 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
identifier 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
decode method are given a chance to restore their state from the same coder object.