title: How do I convert a UIColor to a hexadecimal string?
body: <p>I have a project where I need to store the RGBA values of a UIColor in a database as an 8-character hexadecimal string. For example, [UIColor blueColor] would be @"0000FFFF".
  I know I can get the component values like so:</p>
  
  <pre><code>CGFloat r,g,b,a;
  [color getRed:&amp;r green:&amp;g blue: &amp;b alpha: &amp;a];
  </code></pre>
  
  <p>but I don't know how to go from those values to the hex string. I've seen a lot of posts on how to go the other way, but nothing functional for this conversion.</p>