Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Color difference between drawRect and Interface Builder?

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

enter image description here

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];
}

The result:

enter image description here

Why does this difference exist??


EDIT: (unecessary drawRect Code removed)


EDIT2:

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:

Perfect!!

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

like image 539
Mazyod Avatar asked May 28 '12 04:05

Mazyod


1 Answers

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

How do I enter RGB values into Interface Builder?

Illustration:

enter image description here

like image 62
Mazyod Avatar answered Sep 28 '22 06:09

Mazyod