Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 6 Interface Builder - color picker oddity/bug?

I've recently been tearing my hair out over trying to set the same background color for views styled using Interface Builder, and views styled programatically using [UIColor colorWithRed: green: blue: alpha:]. Despite setting the same RGB values, the views styled in IB were a slightly different color shade to those styled in code.

I finally realised it was to do with color spaces - when I examined the views in IB using the color picker, it showed the color space was set to 'sRGB' rather than the default of 'Generic RGB' which UIColor uses. I never changed the color space setting myself. I then realised what is happening is that when you manually type in the RGB values in the color picker, it changes the color space to 'sRGB' without you knowing therefore giving a different color. However if you use the mouse to drag the slider bars to change the values then the color space remains at 'Generic RGB' and all is well.

Is this a bug, or am I misunderstanding the color picker? I'm using Xcode 6.1.

like image 223
Jonathan Wareham Avatar asked Oct 30 '14 22:10

Jonathan Wareham


1 Answers

A solution is to use "Device RGB" and not "Generic RGB". enter image description here

like image 70
Scinfu Avatar answered Sep 24 '22 20:09

Scinfu