title: hex color from uicolor
body: <p>i have a problem in converting uicolor to hex color, here what i found </p>
  
  <pre><code>CGColorRef colorref = [[Colorview_ backgroundColor] CGColor];
  
  int numComponents = CGColorGetNumberOfComponents(colorref);
  
  if (numComponents == 4) {
      const CGFloat *components = CGColorGetComponents(colorref);
  
      int hexValue = 0xFF0000*components[0] + 0xFF00*components[1] + 0xFF*components[2];
  
      NSString *hexString = [NSString stringWithFormat:@"#%d", hexValue];
  }
  </code></pre>
  
  <p>this code is giving me #5576149 (for example) for hexString, us you see there are 7 digits not 6, it's not a hex color, any help will be appreciated, thx.</p>