Color difference between drawRect and Interface Builder?

后端 未结 2 1843
清酒与你
清酒与你 2020-12-31 17:25

Simply, I have 2 views in interface builder, one is set to the color 99,99,99 using the RGB sliders in interface builder.

相关标签:
2条回答
  • 2020-12-31 18:17

    colorWithWhite uses grayscale space, and a color of 99 in grayscale space doesn't map to a color of (99,99,99) in RGB space.

    So in order to get the same result as in Interface Builder, you need to use RGB space. Replace your call to colorWithWhite with this:

    [UIColor colorWithRed:99/255.0 green:99/255.0 blue:99/255.0 alpha:1.0]
    
    0 讨论(0)
  • 2020-12-31 18:23

    I finally reached the fine-tuning stage of this app, and had to solve this issue, so, I searched and easily found the solution:

    How do I enter RGB values into Interface Builder?

    Illustration:

    enter image description here

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