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!