title: Change UIButton BG color on highlighted, but preserve layer corner radius?
body: <p>I’m changing the background colour of a <code>UIButton</code> via this category method, using a 1px by 1px image:</p>
  
  <pre><code>- (void)setBackgroundColor:(UIColor *)backgroundColor forState:(UIControlState)state
  {
      UIGraphicsBeginImageContextWithOptions(CGSizeMake(1, 1), NO, 0);
      [backgroundColor setFill];
      CGContextFillRect(UIGraphicsGetCurrentContext(), CGRectMake(0, 0, 1, 1));
      UIImage *backgroundImage = UIGraphicsGetImageFromCurrentImageContext();
      [self setBackgroundImage:backgroundImage forState:state];
      UIGraphicsEndImageContext();
  }
  </code></pre>
  
  <p>However, this overrides my setting of the <code>.layer.cornerRadius</code>. I need a button with rounded corners, but also one whose background colour I can change on highlighted.</p>
  
  <p>Any way around this? The corner radius needs to be dynamic.</p>