我在OS X上显示一个本地NSUserNotification,代码如下:

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];

我面临的问题是,如果单击通知本身或"action button",我只会收到一条消息,但如果单击"other"按钮(关闭按钮),我也想执行一些代码 . 如果NSUserNotification被解除或点击关闭按钮,有没有办法得到通知?单击关闭按钮时不会触发NSUserNotificationCenter的 userNotificationCenter:didActivateNotification: .

如果这是不可能的,有没有办法在其Reminder应用程序中创建Apple使用的下拉按钮(如果用户持有操作按钮,则会打开一个菜单) .

谢谢!