【发布时间】:2015-12-22 04:16:19
【问题描述】:
目前,当我使用警报样式创建 NSUserNotification 时,除非我手动关闭它,否则它不会隐藏。
有没有办法让我在 2 秒后自动关闭/隐藏它?
NSUserNotification 代码供参考:
let notification:NSUserNotification = NSUserNotification()
notification.title = "Title"
notification.subtitle = "Subtitle"
notification.informativeText = "Informative text"
notification.soundName = NSUserNotificationDefaultSoundName
notification.deliveryDate = NSDate(timeIntervalSinceNow: 10)
notification.hasActionButton = false
let notificationcenter:NSUserNotificationCenter = NSUserNotificationCenter.defaultUserNotificationCenter()
notificationcenter.scheduleNotification(notification)
【问题讨论】:
标签: cocoa notifications swift2