title: Why can't I create a CAGradientLayer using custom colors in ARC?
body: <p>In the following code for my table view controller, if I use "stock" colors like <code>[UIColor blueColor]</code> it works fine, however if I try to create a custom color using RGBA values, it fails horribly and doesn't draw anything but solid black.</p>
  
  <p>Is this because ARC is deallocating the CGColorRef before it can be used? How can I get this to work with custom colors?</p>
  
  <pre><code>- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
      [cell setBackgroundColor:[UIColor clearColor]];
  
      CAGradientLayer *selectedGrad = [CAGradientLayer layer];
      selectedGrad.frame = cell.bounds;
  
      UIColor* colorOne = [UIColor blueColor];//[UIColor colorWithRed:96/255 green:157/255 blue:227/255 alpha:1];
      UIColor* colorTwo = [UIColor greenColor];//[UIColor colorWithRed:54/255 green:123/255 blue:201/255 alpha:1];
  
      NSArray* colors = [NSArray arrayWithObjects:(id)colorOne.CGColor, colorTwo.CGColor, nil];
  
      selectedGrad.colors = colors;
      selectedGrad.locations = [NSArray arrayWithObjects:@(0.0), @(1.0), nil];
  
      [cell setSelectedBackgroundView:[[UIView alloc] init]];
      [cell.selectedBackgroundView.layer insertSublayer:selectedGrad atIndex:0];
  }
  </code></pre>