8

I am showing a local NSUserNotification on OS X with the following code:

NSUserNotification *notification = [[NSUserNotification alloc] init];
[notification setTitle:@"Some Title"];
[notification setHasActionButton:YES];
[notification setActionButtonTitle:@"Snooze"];

NSUserNotificationCenter *center = [NSUserNotificationCenter defaultUserNotificationCenter];
[center setDelegate:self];
[center scheduleNotification:notification];

The problem I am facing is that I only get a message if either the notification itself or the "action button" is clicked, but I also want to execute some code if the "other" button (close button) is clicked. Is there any way to get notified if a NSUserNotification is dismissed or when the close button is clicked? NSUserNotificationCenter's userNotificationCenter:didActivateNotification: is not triggered when the close button is clicked.

If that is impossible, is there any way to create a dropdown-button like Apple uses in its Reminder application (there, a menu opens if the user holds the action button).

Thanks!

BlackWolf
  • 5,239
  • 5
  • 33
  • 60
  • 3
    Possible duplicate of [Mac OS X NSUserNotificationCenter notification get dismiss event/callback](http://stackoverflow.com/questions/21110714/mac-os-x-nsusernotificationcenter-notification-get-dismiss-event-callback) – Daniel Storm Feb 25 '16 at 22:47

0 Answers0