10

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

bandejapaisa
  • 26,576
  • 13
  • 94
  • 112
  • possible duplicate of [Weird colors in XCode Interface Builder?](http://stackoverflow.com/questions/7488378/weird-colors-in-xcode-interface-builder) – heisenberg Feb 16 '12 at 20:39
  • Not quite, but I found the answer in one of the comments of another post that linked to the post you just gave me! Thanks – bandejapaisa Feb 16 '12 at 20:45

2 Answers2

9

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

Community
  • 1
  • 1
bandejapaisa
  • 26,576
  • 13
  • 94
  • 112
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.)

picciano
  • 22,341
  • 9
  • 69
  • 82
  • I was setting it to 1.0 in the code. 100% in IB. See my answer for the correct answer that solved. Never knew about these colour spaces! – bandejapaisa Feb 16 '12 at 20:48