title: UIButton gradient not working
body: <p>I found this code from tutorial and tried to use it:</p>
  
  <pre><code>CAGradientLayer *btnGradient = [CAGradientLayer layer];
  btnGradient.frame = button.bounds;
  btnGradient.colors = [NSArray arrayWithObjects:
                        (id)[[UIColor colorWithRed:102.0f / 255.0f green:102.0f / 255.0f blue:102.0f / 255.0f alpha:1.0f] CGColor],
                        (id)[[UIColor colorWithRed:51.0f / 255.0f green:51.0f / 255.0f blue:51.0f / 255.0f alpha:1.0f] CGColor],
                        nil];
  [button.layer insertSublayer:btnGradient atIndex:0];
  </code></pre>
  
  <p>The code is in viewDidLoad method.</p>
  
  <p>button is defined like this in .h file: <code>@property (nonatomic, strong) IBOutlet UIButton *button;</code></p>
  
  <p>and it's @synthesized in .m file and it's connected in interface builder</p>
  
  <p>I am able to do other customization to the button like changing its background color (solid color) and changing the color of text. But when I try to use gradient color the background is just transparent. </p>
  
  <p>I appreciate your help!</p>