【发布时间】:2019-11-21 11:36:14
【问题描述】:
我想使用 UIColor 作为对象的前景色,但我不知道如何将 UIColor 转换为 Color
var myColor: UIColor
RoundedRectangle(cornerRadius: 5).foregroundColor(UIColor(myColor))
【问题讨论】:
-
我知道我可以使用单个属性,但我认为可能有更简单的方法
-
我明白了,但苹果可能已经为我提供了一种方法,所以我认为询问是合法的。如果您不这么认为,我很抱歉
-
我后来发现没有内置强制,这就是为什么我接受了帮助其他人解决同样问题的答案。
标签: swift colors uicolor swiftui