In my application, I use the alarm function. It works great. When I press the right button, it launches my application. But I want to run View Controller, which is not rootViewController. I tried searching on Google and SO, but I could not understand or imagine.
I am looking for any example to achieve this.
Thanks for helping the guys.
EDIT
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Add the view controller view to the window and display. [self.window addSubview:alarmViewController.view]; [self.window makeKeyAndVisible]; application.applicationIconBadgeNumber = 0; // Handle launching from a notification UILocalNotification *localNotif = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey]; if (localNotif) { NSLog(@"Recieved Notification %@",localNotif); window = [[UIApplication sharedApplication] keyWindow]; UIViewController *rootViewController = [window rootViewController]; [rootViewController presentModalViewController:receipeViewController animated:YES]; } // Override point for customization after application launch. return YES;
}
- (void)application:(UIApplication *)app didReceiveLocalNotification:(UILocalNotification *)notif { // Handle the notificaton when the app is running NSLog(@"Recieved Notification %@",notif); //Called here as well window = [[UIApplication sharedApplication] keyWindow]; UIViewController *rootViewController = [window rootViewController]; [rootViewController presentModalViewController:receipeViewController animated:YES]; }
source share