简体   繁体   中英

Style of NSUserNotification

A NSUserNotification only shows the action button if the user sets the style of the notifications for my app to "alerts" in the system preferences. Can I somehow set this style for my application as a default instead of relying on the user to manually select it?

It took me a while to track down how to accomplish this in my own app.
According to Apple's info.plist keys reference :

NSUserNotificationAlertStyle Specifies whether the notification style should be banners , alerts , or none . The default value is banners, which is the recommended style.

In your case you need to define the key NSUserNotificationAlertStyle in info.plist with the value alert .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM