在macCatalyst中设置tintColor

问题描述

在macOS Big Sur中,允许使用multicolor强调色,从理论上讲,不再覆盖应用的自定义色彩。

preferences

这可以在一些系统应用程序中看到:

podcasts

music

(来自this tweet的图像)

但是,设置视图,窗口甚至tintColor的{​​{1}}属性仍然会导致macCatalyst中的默认蓝色。甚至没有设置复选框(UIView.appearance()的{​​{1}}也不起作用。

error

这是错误还是有正确的方法?

解决方法

您可以通过与设置Watch应用程序的颜色相同的方式进行操作:

  1. 打开应用程序的资产目录。
  2. 选择“编辑器”>“添加新资产”>“颜色集”菜单项,以将新颜色集添加到资产目录。
  3. 在应用的“构建设置”中,将“全局口音颜色名称”设置为您的颜色集名称。

Apple的WatchKit说明在这里,但实际上在所有平台上都是相同的:https://developer.apple.com/documentation/watchkit/setting_the_app_s_tint_color

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...