Interface Builder 颜色与代码颜色不同

发布于 2025-01-06 13:13:30 字数 434 浏览 5 评论 0原文

我所缺少的有什么不同。我以前没有注意到这一点,或者我在做一些愚蠢的事情......

在界面生成器中获得了一个视图,使用 RGB 滑块 44、44、44 设置其背景颜色。不透明度 1。设置为不透明。

当我运行该应用程序时,它已将其更改为 33, 33, 33 ????

如果在视图中出现,我使用...更改它

self.topView.backgroundColor = [UIColor colorWithRed:44.0f/255.0f green:44.0f/255.0f blue:44.0f/255.0f alpha:1.0f];

......然后一切都好。

这是在做什么?

任何颜色都会发生这种情况。如果我选择 200, 250, 5 - 我运行应用程序,它已更改为 200, 120, 5 ???

What is different here that I'm missing. I haven't noticed this before, or I'm doing something stupid.....

Got a view in interface builder, set its background colour using RGB sliders 44, 44, 44. Opactity 1. Set as opaque.

When I run the app, it has changed it to 33, 33, 33 ????

If in the view will appear, I change it using....

self.topView.backgroundColor = [UIColor colorWithRed:44.0f/255.0f green:44.0f/255.0f blue:44.0f/255.0f alpha:1.0f];

..then everything is ok.

What is doing this?

It happens with any colour. If i choose 200, 250, 5 - i run the app and it has changed to 200, 120, 5 ????

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

游魂 2025-01-13 13:13:30

我必须选择正确的色彩空间...

感谢 Ken 在这篇文章中的评论

其他问题:

实际上,要小心放大镜。仅组件编号
不要指定颜色,您还需要知道色彩空间。就像
字符串编码。 65 是 A 的 ASCII 编码。颜色空间
对组件进行编码/解码的小下拉列表中
上面“RGB”滑块的左侧。 “通用 RGB”色彩空间对应
使用 +[NSColor 制作的颜色
colorWithCalibatedRed:green:blue:alpha:]。如果你使用放大镜
玻璃,组件将根据“设备”空间给出
这意味着当前屏幕。这是不合适的。选择
通用之后

I had to choose the correct colorspace...

Thanks to a comment by Ken from this post

Other question:

Actually, be careful with the magnifying glass. Just component numbers
do not spec a color, you also need to know the colorspace. It's like
string encodings. 65 is the ASCII encoding of A. The colorspace with
which to encode/decode the components is in the little dropdown to the
left of "RGB" sliders above. The "Generic RGB" colorspace corresponds
to colors made with +[NSColor
colorWithCalibratedRed:green:blue:alpha:]. If you use the magnifying
glass, the components will be given with respect to "device" space
which means the current screen. This is not appropriate. Select
generic after

怪我太投入 2025-01-13 13:13:30

在 Interface Builder 中,确保将不透明度设置为 100%,而不是 1%。 (您的问题表明您将其设置为 1。)

In Interface Builder, be sure you're setting the opacity to 100%, not 1%. (Your question states that you're setting it to 1.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文