title: Creating a UIImage from a UIColor to use as a background image for UIButton
body: <p>I'm creating a colored image like this:</p>
  
  <pre><code>CGRect rect = CGRectMake(0, 0, 1, 1);
  UIGraphicsBeginImageContext(rect.size);
  CGContextRef context = UIGraphicsGetCurrentContext();
  CGContextSetFillColorWithColor(context,
                                     [[UIColor redColor] CGColor]);
  //  [[UIColor colorWithRed:222./255 green:227./255 blue: 229./255 alpha:1] CGColor]) ;
  CGContextFillRect(context, rect);
  UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
  UIGraphicsEndImageContext();
  </code></pre>
  
  <p>and then use it as the background image of a button:</p>
  
  <pre><code>[resultButton setBackgroundImage:img forState:UIControlStateNormal];
  </code></pre>
  
  <p>This works great using the redColor, however I want to use an RGB color (as shown in the commented line). When I use the RGB color, the buttons background isn't changed.</p>
  
  <p>What am I missing?</p>