类: TouchBarLabel

在原生macOS应用程序的触摸栏中创建一个标签

Process: Main

new TouchBarLabel(options) 实验功能

  • options Object
    • label String (可选) - 显示的文本.
    • accessibilityLabel String (optional) - A short description of the button for use by screenreaders like VoiceOver.
    • textColor String(可选) - 文本的十六进制颜色,例如#ABCDEF。

When defining accessibilityLabel, ensure you have considered macOS best practices.

实例属性

以下属性可用于 TouchBarLabel:

touchBarLabel.label

A String representing the label’s current text. Changing this value immediately updates the label in the touch bar.

touchBarLabel.accessibilityLabel

A String representing the description of the label to be read by a screen reader.

touchBarLabel.textColor

A String hex code representing the label’s current text color. Changing this value immediately updates the label in the touch bar.