Note that there are some explanatory texts on larger screens.

plurals
  1. POSaving and Restoring Application State on iOS 6 without Storyboards
    text
    copied!<p>I have done test app following this <a href="http://www.techotopia.com/index.php/An_iOS_6_iPhone_State_Preservation_and_Restoration_Tutorial" rel="nofollow">tutorial</a></p> <p>I try to do the same without using Storyboards and it isn't work. I have enabled state preservation and restoration in AppDelegate. I have assigned restorationIdentifier to all my controllers and their views. I think i have to implement some additional code in AppDelegate to restore rootviewcontroller, but i cannot find the right way to do this.</p> <pre><code>-(BOOL)application:(UIApplication *)application shouldRestoreApplicationState:(NSCoder *)coder { return YES; } -(BOOL)application:(UIApplication *)application shouldSaveApplicationState:(NSCoder *)coder { return YES; } - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; // Override point for customization after application launch. UIViewController *viewController1 = [[[StateTestFirstViewController alloc] initWithNibName:@"StateTestFirstViewController" bundle:nil] autorelease]; UIViewController *viewController2 = [[[StateTestSecondViewController alloc] initWithNibName:@"StateTestSecondViewController" bundle:nil] autorelease]; self.tabBarController = [[[UITabBarController alloc] init] autorelease]; self.tabBarController.restorationIdentifier = @"TabBarController"; self.tabBarController.viewControllers = @[viewController1, viewController2]; self.window.rootViewController = self.tabBarController; [self.window makeKeyAndVisible]; return YES; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload