【问题标题】:Convert CGColor to corresponding UIColor in Swift在 Swift 中将 CGColor 转换为对应的 UIColor
【发布时间】:2015-05-06 19:54:25
【问题描述】:

我正在使用浅蓝色 CGColor,现在我想使用这种确切的颜色作为 UIButton 的背景。

如何将CGColor 转换为UIColor

【问题讨论】:

    标签: swift uicolor cgcolor


    【解决方案1】:

    使用 UIColor(cgColor: ...) 从 CGColor 中获取 UIColor:

    let uiColor = UIColor(cgColor: cgColor)
    

    然后将其作为背景颜色分配给您的按钮。

    【讨论】:

      猜你喜欢
      • 2018-08-31
      • 2017-08-11
      • 2020-09-07
      • 2018-06-03
      • 1970-01-01
      • 2017-04-07
      • 2019-09-29
      • 1970-01-01
      相关资源
      最近更新 更多