Reputation: 26952
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 ????
Upvotes: 10
Views: 1975
Reputation: 26952
I had to choose the correct colorspace...
Thanks to a comment by Ken from this post
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
Upvotes: 9
Reputation: 22701
In Interface Builder, be sure you're setting the opacity to 100%, not 1%. (Your question states that you're setting it to 1.)
Upvotes: 1