Xcode:找不到控件的 rgb 颜色选择器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11942664/
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-15 01:13:49  来源:igfitidea点击:

Xcode: Cant find rgb color picker for controls

xcodecolor-pickerdeveloper-tools

提问by jayvatar

Using Xcode 4.3.2 I am unable to add color values by rgb. The standard picker looks like this enter image description here

使用 Xcode 4.3.2 我无法通过 rgb 添加颜色值。标准选择器看起来像这样在此处输入图片说明

Which does not offer any input for rgb or have any sliders allowing me to set anything else.

它不为 rgb 提供任何输入,也没有任何滑块允许我设置任何其他内容。

The custom picker at this location http://www.panic.com/~wade/picker/instructs me to install at

这个位置的自定义选择器http://www.panic.com/~wade/picker/指示我安装在

/home/Library/ColorPickers.

/home/图书馆/ColorPickers。

However home is not editable. So I placed it into

但是 home 是不可编辑的。所以我把它放入

/Users/username/Library/ColorPickers

/用户/用户名/图书馆/ColorPickers

which does nothing. (Is this correct?) Can anyone explain how to properly install this? Thanks

什么都不做。(这是正确的吗?)谁能解释一下如何正确安装它?谢谢

回答by Mick MacCallum

I use this tool and it works fine, /home is referring to /Users/Username so you did place it in the right folder.

我使用这个工具并且它工作正常,/home 指的是 /Users/Username 所以你确实把它放在了正确的文件夹中。

If the tool still isn't working then you will need to restart Xcode and possibly even the computer.

如果该工具仍然无法正常工作,那么您将需要重新启动 Xcode,甚至可能需要重新启动计算机。

After that you simply open the standard picker in Xcode, it isn't replaced, a new tab is added to it.

之后,您只需在 Xcode 中打开标准选择器,它不会被替换,而是添加了一个新选项卡。

enter image description here

在此处输入图片说明

Additionally, you can always manually specify RGB values in code, for example:

此外,您始终可以在代码中手动指定 RGB 值,例如:

[myLabel setTextColor:[UIColor colorWithRed:235.2/255 green:150.7/255 blue:35.1/255 alpha:1.0]];

The values are x/255 because UIColor expects a float value between 0 and 1 and this is an easy way to convert the standard RGB 255 values down to 0-1.

这些值是 x/255,因为 UIColor 需要一个介于 0 和 1 之间的浮点值,这是将标准 RGB 255 值转换为 0-1 的简单方法。

回答by Jeff Schmitz

I had the same problem, and it's simply that your Toolbar is not showing. Go to View->ShowTool bar and you should now see a tab bar of color picker options. For more information on installing custom color pickers, visit https://developer.apple.com/library/mac/documentation/cocoa/conceptual/DrawColor/Tasks/AddingColorPickers.html

我遇到了同样的问题,只是您的工具栏没有显示。转到“查看”->“显示工具栏”,您现在应该会看到一个颜色选择器选项的标签栏。有关安装自定义颜色选择器的更多信息,请访问https://developer.apple.com/library/mac/documentation/cocoa/conceptual/DrawColor/Tasks/AddingColorPickers.html