title: CALayer mask - combining two layers
body: <p>In my app i have a view and i want it to have a small transparent gradients on left and right side. I am able to create either left or right gradient pretty easily, but i dont know how to combine them : </p>
  
  <pre><code>CAGradientLayer *rightLayer = [CAGradientLayer layer];
  rightLayer.frame = self.bounds;
  rightLayer.colors = [NSArray arrayWithObjects:(id)[UIColor whiteColor].CGColor, (id)[UIColor clearColor].CGColor, nil];
  rightLayer.startPoint = CGPointMake(0.8f, 1.0f);
  rightLayer.endPoint = CGPointMake(1.0f, 1.0f);
  
  CAGradientLayer *leftLayer = [CAGradientLayer layer];
  leftLayer.frame = self.bounds;
  leftLayer.colors = [NSArray arrayWithObjects:(id)[UIColor clearColor].CGColor,(id)[UIColor whiteColor].CGColor, nil];
  leftLayer.startPoint = CGPointMake(0.0f, 1.0f);
  leftLayer.endPoint = CGPointMake(0.2f, 1.0f);
  
  
  self.layer.mask = leftLayer;
  </code></pre>
  
  <p>As you can see, the problem is that i must assign only 1 layer to mask and i want it to have 2 layers. How do i merge leftLayer and rightLayer? Or how do i add both of these layers to mask?</p>
  
  <p>Thanks a lot for answering!</p>