如何在 Xcode xib 编辑器中查看颜色代码?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7967106/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to view a color code in the Xcode xib editor?
提问by Louis Waweru
I've been using a color that I chose with a color picker in Xcode. I need to use that color programmatically now, but I don't know its hex code.
我一直在使用我在 Xcode 中通过颜色选择器选择的颜色。我现在需要以编程方式使用该颜色,但我不知道它的十六进制代码。
Is there a way to see it in Xcode?
有没有办法在Xcode中看到它?
I'm using Xcode 4.2.
我正在使用 Xcode 4.2。
回答by 4aRk Kn1gh7
As of Xcode 6, users can view both RGB, CMYK, HSBand the Hex valueas shown below. (No need for conversion)
从 Xcode 6 开始,用户可以查看RGB、CMYK、HSB和Hex 值,如下所示。(无需转换)
回答by Saran
回答by Tendulkar
write this in .m file
将此写入 .m 文件
1.NSLog(@"color is %@",picker.color);
1.NSLog(@"颜色是%@",picker.color);
回答by Wesley Smith
ColorSense is a very simple xcode extension that makes it easy to do exactly what you needed.
ColorSense 是一个非常简单的 xcode 扩展,可以轻松完成您需要的操作。
Use as below:
使用如下:
Watch the short video hereto see how it works.