Builder之间的色差

Builder之间的色差

本文介绍了drawRect和Interface Builder之间的色差?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

简单地说,我在界面构建器中有2个视图,其中一个使用界面构建器中的RGB滑块设置为颜色99,99,99。

Simply, I have 2 views in interface builder, one is set to the color 99,99,99 using the RGB sliders in interface builder.

另一个视图以编程方式着色以实现一定的形状。我填写它:

The other view is colored programmatically to achieve a certain shape. I fill it using:

//Obviously, this is in drawRect.
[[UIColor leadColor] set];
CGContextEOFillPath(myContext);

//And this is a category on UIColor
+ (UIColor *)leadColor {
    return [UIColor colorWithWhite:99/255.0 alpha:1.0];
}

结果:

为什么这样差异存在??

Why does this difference exist??

(不必要的 drawRect 删除了代码)

(unecessary drawRect Code removed)

EDIT2:

所以,我在这里骗自己......界面构建器将RGB 99,99,99显示为80,80,80。我敢打赌它将数字偏移19。 >。> ...一个绝望的人使用Xcode认为像这样的疯狂的东西..结果:

So, here I am lying to myself .. "Interface builder showed RGB 99,99,99 as 80,80,80. I bet it offsets the number by 19." >.> ... A desperate man using Xcode thinks crazy stuff like this .. The result:

完美!! ,但为什么 ????另一个Xcode错误?我发现过去一个月中有10个... ...

PERFECT!!, but why???? Another Xcode bug? I found like 10 of those in the past month ...

推荐答案

我终于达到了这个应用的微调阶段,并且必须解决这个问题,所以,我搜索并轻松找到解决方案:

I finally reached the fine-tuning stage of this app, and had to solve this issue, so, I searched and easily found the solution:

插图:

这篇关于drawRect和Interface Builder之间的色差?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 05:44