Asks the delegate to provide the specified view controller.
- iOS 6.0+
- tvOS 9.0+
Your singleton app object.
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 the app delegate does not supply this view controller. If this method returns
nil, UIKit tries to find the view controller implicitly using the available restoration path and storyboard information.
During state restoration, when UIKit encounters a view controller without a restoration class, it calls this method to ask for the corresponding view controller object. Your implementation of this method should create (or find) the corresponding view controller object and return it. If your app delegate does not provide the view controller, return
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, you would always return the existing view controllers loaded from your app’s main storyboard file rather than create new objects.
Your implementation of this method may use any data in the provided
coder to assist in the restoration process. However, you usually 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 normally given a chance to restore their state form the same coder object. Similarly, the app delegate itself has a
application: method that you can use to restore app-level state information.