如何在 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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 22:17:55  来源:igfitidea点击:

How to view a color code in the Xcode xib editor?

xcode

提问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 开始,用户可以查看RGBCMYKHSBHex 值,如下所示。(无需转换)

enter image description here

在此处输入图片说明

回答by Saran

Assuming you are talking about picking color in xcode interface builder, the answer can be obtained in 2 steps:

假设您正在谈论在 xcode 界面构建器中选择颜色,则可以通过 2 个步骤获得答案:

Step 1: Get RGB values by following this link.

步骤 1:按照此链接获取 RGB 值。

Step 2: Convert that to hex code by following this link

第 2 步:按照此链接将其转换为十六进制代码

回答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:

使用如下:

enter image description hereenter image description here

在此处输入图片说明在此处输入图片说明

Watch the short video hereto see how it works.

观看这里短视频,了解它是如何工作的。

You can download the extension here

您可以在此处下载扩展程序