NotificationAction 对象
优质
小牛编辑
127浏览
2023-12-01
type
类型:String - 此类操作可以作为按钮
.text
类型:String(可选) - 给定操作的标签。
NotificationAction Object
type
String - The type of action, can bebutton
.text
String (optional) - The label for the given action.
平台 / 操作 支持
操作类型 | 平台支持 | text 参数 | text 参数默认值 | 局限性 |
---|---|---|---|---|
button | macOS | button 显示的内容 | "Show" ( 如果是第一个这类 button ,则为系统默认的本地化字符串,否则为空) | 只使用第一个。 如果提供了多个, 则第一个之外的那些将被列为附加操作 (当鼠标停留在按钮上时显示)。 任何这类操作都与 hasReply 不兼容, 如果 hasReply 为 true , 则将忽略此行为。 |
Platform / Action Support
Action Type | Platform Support | Usage of text | Default text | Limitations |
---|---|---|---|---|
button | macOS | Used as the label for the button | "Show" (or a localized string by system default if first of such button , otherwise empty) | Only the first one is used. If multiple are provided, those beyond the first will be listed as additional actions (displayed when mouse active over the action button). Any such action also is incompatible with hasReply and will be ignored if hasReply is true . |
MacOS系统上的按钮支持
为了在 macOS 上使用额外的通知按钮, 您的应用程序必须符合以下标准。
- 应用程序已签名
- 应用将
info.plist
变量中的NSUserNotificationAlertStyle
属性值设置为alert
这些要求如果有一个不满足,按钮就不会显示。
Button support on macOS
In order for extra notification buttons to work on macOS your app must meet the following criteria.
- App is signed
- App has it's
NSUserNotificationAlertStyle
set toalert
in theInfo.plist
.
If either of these requirements are not met the button won't appear.