【发布时间】:2019-08-26 08:47:27
【问题描述】:
我想将UISegmentControl 中的默认SelectedTintColor 匹配到另一个视图,但我无法从属性检查器中提供的默认系统* 颜色中找到匹配的颜色。
背景似乎是.quaternarySystemFill,但在明暗模式下都没有与所选颜色相匹配的颜色。
即使以这种方式设置颜色也不起作用,因为.selectedSegmentTintColor 返回nil:
label.backgroundColor = segmentedControl.selectedSegmentTintColor
有人知道正确的颜色吗?或者我需要使用自定义颜色吗?
编辑 2: 目前这条线路可行,但也许有更好的方法?
label.backgroundColor = label.traitCollection.userInterfaceStyle == .light ? .white : .tertiaryLabel
【问题讨论】: