This is didFinishLaunchingWithOptions Method in AppDelegate. Let me explain scenario, I have developed sideMenu like facebook in my app, but now I have to change the sideMenu list according to screens (ViewController)
Here the side Menu is SideMenuViewController, which is an argument in contain, which ultimately becomes window's rootViewController.
SO, The very basic question arises is "How to change the controller or variable which becomes rootViewController of windows"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
SideMenuViewController *leftMenuViewController = [[SideMenuViewController alloc] init];
self.container = [ContainerOfSideMenuByVeerViewController
containerWithCenterViewController:[self navigationController]
leftMenuViewController:leftMenuViewController];
self.window.rootViewController = self.container;
[self.window makeKeyAndVisible];
return YES;
}
If any programmer wants to know more code or requirement, I do welcome to provide by editing my code or in comments.
Try this:
<YourAppDelegateClass> *app = [[UIApplication sharedApplication] delegate];
app.window.rootViewController = <YourRootViewController>;
Don't forget to include necessary headers (your AppDelegate, for example) or you'll get CE. This one seems to work: