I’m writing a storyboard-based iPhone app and working on state restoration. When performing the segues normally, I want to have them animate, but when I’m restoring several levels of a navigation hierarchy, I only want the last segue to animate. Other than setting up two sets of segues—one set that uses a normal push segue, and another that uses a custom non-animating push segue—is there any way to achieve what I’m trying to do?
I’m writing a storyboard-based iPhone app and working on state restoration. When performing the
Share
It’s possible to directly manipulate the view controller stack, independently of the application’s segues or storyboards.
You can use this technique to restore a deep stack of view controllers, and perform / animate just a single segue to the top view controller. (You will likely need to create a specific push segue for this purpose.)
For example, to restore a two view controller stack, you could do the following. In this example, it’s assumed that some action on an existing view controller leads to the state restore, but you can just as easily perform it from your App Delegate.
If, instead, you prefer to have no animations, then it’s easier still. You can restore state solely by manipulating the view controller stack (and without using any segues) from
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptionsand- (void)applicationWillEnterForeground:(UIApplication *)application.Either way will work seamlessly and in tandem with your existing storyboard(s) and segues.