Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>In you app delegate...</p> <pre><code>- (void) presentWidget: (NSString*)theDisplayedText { BOOL widgetIspresent = [WidgetVC widgetIsCurrentlyPresented]; if (!widgetIspresent) { WidgetVC *widgetVC = [[WidgetVC alloc] initWithNibName:@"WidgetVC" userInfoString:theDisplayedText bundle:nil]; widgetVC.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; widgetVC.userInfoStr = theDisplayedText; [mainScreenManager presentViewController:widgetVC animated:YES completion:nil]; } } - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { UILocalNotification *localNotif = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey]; if (localNotif) { NSLog(@"Recieved Notification didFinishLaunchingWithOptions %@",localNotif); NSString *theDisplaytext = [localNotif.userInfo valueForKey:@"someKey"]; //here we have to handle whatever notification was pressed - that might also be an old aready passed one //this all is checked when the widget opens - it will show if the notification is OK or too old [self presentWidget: theDisplaytext ]; } else { //so we started the app normally, not via local notification [self presentWidget]; } return YES; } // Handle the notificaton when the app is running - (void)application:(UIApplication *)app didReceiveLocalNotification:(UILocalNotification *)localNotif { // Handle the notificaton when the app is running NSLog(@"Recieved Notification didReceiveLocalNotification %@",localNotif); NSString *theDisplaytext = [localNotif.userInfo valueForKey:@"someKey"]; [self presentWidget: theDisplaytext]; } </code></pre> <p>You need a way to start the UIViewController for the widget, I just created a mainScreenManager helper.</p> <p>So on the widgetVC you have your "Snooze" and "OK" while the "Ignore" is just the ignoring of the notification itself.</p> <p>Hope this gets you on an usable track...</p> <p>ps I ported my app from Android to iPhone, that's why I used the name "widgetVC" for this screen. On Android it is implemented as a widget. Hope no iPhone lover feels offended :-)</p>
 

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