title: Masking UITableViewCell (paralax effect)
body: <p>In my App I am trying to get a paralax effect in my table. (e.g it's background) which contains a blurred map for each entry. </p>
  
  <p>How I've set it up is i have a <code>XIB</code> with a <code>UITableViewCell</code> and have added the labels to the contentView. Then in code I add the image to the backgroundView. (The backgroundView doesn't exist, and I create an "empty view" to where I add the image). </p>
  
  <p>Then I add the <code>UIInterpolatingMotionEffect</code> to the image view.</p>
  
  <p>This works. But, since the image has the same dimensions as the table view cell, when a person tilts the phone and the paralax effect kicks in white edges appear. As you can see in the image below.</p>
  
  <p><img src="https://cl.ly/TNTB/IMG_0327.jpg" alt="White edges with paralax"></p>
  
  <p>That is not something I want. So I thought, well I could just put a bigger image in the backgroundView. This works while I am not in editing mode. But in editing mode the background image overlaps partially with the delete button. As seen here:</p>
  
  <p><img src="https://cl.ly/TNVy/IMG_0328.jpg" alt="Overlap in editing mode"></p>
  
  <p>So I thought, I should clip the backgroundView containing the image view. Which I've done with the following code:</p>
  
  <pre><code>self.backgroundView.clipsToBounds = YES;
  </code></pre>
  
  <p>or this</p>
  
  <pre><code>// Create a mask layer and the frame to determine what will be visible in the view.
  CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
  CGRect maskRect = self.bounds;
  
  // Create a path with the rectangle in it.
  CGPathRef path = CGPathCreateWithRect(maskRect, NULL);
  
  // Set the path to the mask layer.
  maskLayer.path = path;
  
  // Release the path since it's not covered by ARC.
  CGPathRelease(path);
  
  // Set the mask of the view.
  self.backgroundView.layer.mask = maskLayer;
  </code></pre>
  
  <p>But neither solutions work. It looks like it is not being clipped. Is there an other way to go about this?</p>