Wrong color in Interface Builder's color picker

前端 未结 6 422
夕颜
夕颜 2020-12-08 10:26

I have an UIImageView with a brown image that will not always reach the top part. The UIImage view is inside a white UIView.

So, because the top part of the image is

相关标签:
6条回答
  • 2020-12-08 11:06

    UPDATE 10.10.4

    I had this issue as well, I reported it to Apple, and it seems to have been solved on 10.10.4 (it was related to the color picker itself, not to Xcode/IB)

    Can someone else confirm it?

    0 讨论(0)
  • 2020-12-08 11:08

    Its because the component numbers don’t spec a color. We also need to know the color space which xCode uses. Colorspace which encodes or decodes is available in the drop down left to the RGB slider.

    enter image description here

    By default xCode chooses the "Generic RGB" and that is what UIColor uses spec color from RGB. If we use magnifying glass, it will change to "Device RGB” space and that is based on your current screen. So “sRGB" or "Adobe RGB" would be the better or close to what you want if you are using the magnifying glass to pick a color.

    0 讨论(0)
  • 2020-12-08 11:10

    I think Generic RGB also works. the trick is you need to enter number of R G B manually after change the RGB mode in dropdown list

    Odd... (too)

    0 讨论(0)
  • 2020-12-08 11:12

    Just wanted to elaborate upon the accepted answer with some screenshots.

    If you want to match RGB values between Photoshop and Xcode exactly (without conversion between colorspaces) then you need to save your images in generic RGB and enter any dropper values using the generic RGB colorspace.

    • When you choose "Save for Web & Devices" from Photoshop, uncheck the "Convert to sRGB" box.

    enter image description here

    • In Xcode, click the colorspace popup in the color picker and choose "Generic RGB", then enter the red, green and blue values from Photoshop, NOT THE HEX VALUE as this reverts back to the sRGB colorspace for some reason (be careful not to tab to the hex field either, as that also changes the colorspace to sRGB).

    enter image description here

    More info here, including how to match screenshots.

    0 讨论(0)
  • 2020-12-08 11:21

    This is an old question, but it was important for me to add some info. The only method that has been working for me accurately over the years was to not use PS's Color Picker, but use macOS' built-in "Digital Color Meter".

    It's bundled with every installation of macOS and the RGB values emitted from there with "Generic RGB" always reproduce the correct color in Xcode Storyboards.

    0 讨论(0)
  • 2020-12-08 11:24

    I've managed to find out a solution/explanation (tho I'm still confused) in this answer: https://stackoverflow.com/a/9203647/460750

    Basically, what I did to solve my issues, was to choose from the RGB "types" select (that little square under the color picker) the Apple RGB option, and enter the R, G and B values manually, instead of using the picker.

    Odd...

    0 讨论(0)
提交回复
热议问题