0

I need to take the user on a specific view (nib) after he click on the button of localNotification: the iPhone play the sound of the notification... the user click on the button... the app come up with the last view he visited... I want to change that view and take the user to another view... Is there a way to do that? Thanks for any help. Massy

Blue
  • 2,300
  • 3
  • 21
  • 32

1 Answers1

0

When the user click the local notification, an AppDelegate method is called :

- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification

You simply have to implement this method in your appDelegate an do whatever you want.

PS : Note that another method is available since iOS8 :

- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forLocalNotification:(UILocalNotification *)notification completionHandler:(void(^)())completionHandler
KIDdAe
  • 2,714
  • 2
  • 22
  • 29
  • I know that method but it doesn't accept [self presentViewController:myView animated:YES completion:nil]; – Blue Jan 28 '15 at 16:12
  • `self` is referring to `AppDelegate` and `AppDelegate` is not a `UIViewController`. What you have to do is to access to your main view controller or your current view controller (using an AppDelegate `property` or an Observer) and ask him to present the view controller you want to show. – KIDdAe Jan 28 '15 at 16:25