ios - 如何从 UIColor 获取 RGB 值?

标签 ios rgb uicolor

我正在使用以下代码创建一个颜色对象。

curView.backgroundColor = [[UIColor alloc] initWithHue:229 saturation:40 brightness:75 alpha:1];

如何从创建的颜色对象中检索 RGB 值?

最佳答案

在 iOS 5 中你可以使用:

CGFloat red = 0.0, green = 0.0, blue = 0.0, alpha =0.0;
[multipliedColor getRed:&red green:&green blue:&blue alpha:&alpha];

关于ios - 如何从 UIColor 获取 RGB 值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/437113/

相关文章:

ios - Parse orQueryWithSubqueries 无法正常工作(快速)

ios - 每次移动超过 50 米时,如何使用新位置更新我的代表?

python - 如何用每个像素的 RGB 值构建图像

ios - CAShapeLayer 描边颜色不读取十六进制颜色代码转换

iphone - 如何将值从 TableView Controller 传递到 customCell 类

swift - 检查颜色是否为蓝色(ish)、红色(ish)、绿色(ish)、

ios - 如何使用 MVVM 和 RxSwift 事件在 UIViewController 及其子 UIView 之间进行通信?

ios - 点击识别器仅在第一个单元格中工作

css - 我可以在 CSS 中更改颜色的单个参数吗?

language-agnostic - 给我画彩虹