UIColor.tertiarySystemBackgroundColor 静态属性
UIColor.tertiarySystemBackgroundColor 静态属性是一个语义色:放在第二层上面的内容的底色。语义色按用途命名,色值由系统决定,跟随浅色模式、深色模式和「增强对比度」设置变化。
日常不需要用它:颜色属性直接写字符串 'tertiarySystemBackground',效果相同。
值
UIColor。
- 只读。给它赋值抛
TypeError。 - 每次取到的是同一个对象:
UIColor.tertiarySystemBackgroundColor === UIColor.tertiarySystemBackgroundColor是true。 - 赋给颜色属性的效果和写
'tertiarySystemBackground'相同。读回来的是字符串'tertiarySystemBackground',不是UIColor对象。写入颜色属性后读出'tertiarySystemBackground',这一点走和其他颜色名同一段代码,未在模拟器逐个验证。 - 具体色值没有量过。
示例
js
const box = new UIView();
box.backgroundColor = UIColor.tertiarySystemBackgroundColor;
console.log(box.backgroundColor);结果:控制台输出 tertiarySystemBackground。屏幕上的颜色未在模拟器验证。
对应的 iOS API
UIColor.tertiarySystemBackgroundColor。Swift 里的名字是 UIColor.tertiarySystemBackground,和这里的颜色名字符串相同。