Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Interface Builder colour different to code color

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 ????

like image 916
bandejapaisa Avatar asked Feb 16 '12 20:02

bandejapaisa


2 Answers

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

like image 104
bandejapaisa Avatar answered Nov 18 '22 19:11

bandejapaisa


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

like image 1
picciano Avatar answered Nov 18 '22 20:11

picciano