Last active
December 20, 2015 12:18
-
-
Save djibouti33/6129555 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
{ | |
UINavController *centerNav = [[UINavController alloc] initWithRootViewController:[FeaturedViewController new]]; | |
centerNav.restorationIdentifier = @"centerNav"; | |
UINavigationController *leftDrawerNavController = [[UINavigationController alloc] initWithRootViewController:[LeftDrawerViewController new]]; | |
leftDrawerNavController.restorationIdentifier = @"leftDrawerNav"; | |
MMDrawerController *drawerViewController = [[MMDrawerController alloc] initWithCenterViewController:centerNav leftDrawerViewController:leftDrawerNavController]; | |
// no restoration class, since this will always be created before state restoration resumes, and therefore will be found implicitly | |
[drawerViewController setRestorationIdentifier:@"mmDrawer"]; | |
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; | |
self.window.rootViewController = drawerViewController; | |
self.window.restorationIdentifier = NSStringFromClass([UIWindow class]); | |
self.window.backgroundColor = [UIColor whiteColor]; | |
[self.window makeKeyAndVisible]; | |
return true; | |
} | |
- (UIViewController *)application:(UIApplication *)application viewControllerWithRestorationIdentifierPath:(NSArray *)identifierComponents coder:(NSCoder *)coder | |
{ | |
if ([[identifierComponents lastObject] isEqualToString:@"leftDrawerNav"]) { | |
return ((MMDrawerController *)self.window.rootViewController).leftDrawerViewController; | |
} | |
if ([[identifierComponents lastObject] isEqualToString:@"centerNav"]) { | |
return ((MMDrawerController *)self.window.rootViewController).centerViewController; | |
} | |
return nil; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment