Objective c 如何删除通知横幅,但将其留在OS X上的通知中心?
我现在做的是:Objective c 如何删除通知横幅,但将其留在OS X上的通知中心?,objective-c,xcode,macos,nsusernotification,nsusernotificationcenter,Objective C,Xcode,Macos,Nsusernotification,Nsusernotificationcenter,我现在做的是: [[NSUserNotificationCenter defaultUserNotificationCenter] removeAllDeliveredNotifications]; 因此,我的问题是,如何将通知保留在通知中心?您可以在执行操作时将其删除,然后再次添加,确保NSUserNotificationCenter委托类将shouldPresentNotification方法实现为NO (BOOL)用户通知中心:(NSUserNotificationCenter*)中心
[[NSUserNotificationCenter defaultUserNotificationCenter] removeAllDeliveredNotifications];
因此,我的问题是,如何将通知保留在通知中心?您可以在执行操作时将其删除,然后再次添加,确保NSUserNotificationCenter委托类将shouldPresentNotification方法实现为NO
- (BOOL)用户通知中心:(NSUserNotificationCenter*)中心 shouldPresentNotification:(NSUserNotification*)nsNotification{ 返回否; }
- (BOOL)用户通知中心:(NSUserNotificationCenter*)中心 shouldPresentNotification:(NSUserNotification*)nsNotification{ 返回否; }