title: hex colors in iOS are not accurate
body: <p>I find that when you set a view's backgroundColor in xib, the color displayed is distinctly different from when you set backgroundColor programmatically. </p>
  
  <p>Here's an example.</p>
  
  <p>I have two views in this simple demo. I set the upper view's backgroundColor in xib, like this:
  <img src="https://i.stack.imgur.com/9IUoq.png" alt="enter image description here"></p>
  
  <p>The hex color value is 0x1BA9BA. Then I set the lower view's backgroundColor programmatically with the same hex color value. I use the following code:</p>
  
  <pre><code>NSInteger hexValue = 0x1ba9ba;
  self.testView.backgroundColor = [UIColor colorWithRed:((float)((hexValue &amp; 0xFF0000) &gt;&gt; 16)) / 255.0 
                                                    green:((float)((hexValue &amp; 0xFF00) &gt;&gt; 8)) / 255.0 
                                                    blue:((float)(hexValue &amp; 0xFF))/255.0 
                                                    alpha:1.0];
  </code></pre>
  
  <p>The result is as follows:</p>
  
  <p><img src="https://i.stack.imgur.com/QkbTg.png" alt="enter image description here"></p>
  
  <p>As you can see, there's a clear difference in color. What am I missing here?</p>