【发布时间】:2017-11-07 22:09:36
【问题描述】:
我通常使用 Swift 扩展在 iOS 上使用自定义 UIColors,但现在使用 iOS 11/Xcode 9 我们可以创建颜色集。我们如何使用它们?
更新 - 提示
正如@Cœur 所说,我们可以拖放颜色,并像 UIColor 对象一样使用它,并且可能的解决方案是将其用作扩展:
或者作为一个常数:
现在我想知道我们是否可以像 UIImage 访问资产图像一样访问它们,例如:
UIImage(named: "image-name") -> UIColor(named: "color-name")
【问题讨论】:
标签: swift uicolor asset-catalog ios11 xcode9-beta