title: Setting mask layer on UITableViewCell's subview overrides Auto Layout constraints
body: <p>I have a <code>UITableViewCell</code> with multiple subviews. One of the subviews is a <code>UILabel</code> and the cell's height is dynamically sized based on the amount of text in the <code>UILabel</code>. This works perfectly.</p>
  
  <p>I have another subview in the cell that has constraints as well. This subview is always supposed to have the exact same height as the cell. This works perfectly as well.</p>
  
  <p>However, I run into problems when trying to set a mask layer on that subview. The mask layer works correctly, but then the subview's height is wrong and it is not the same height as the cell.</p>
  
  <p>Here is my mask layer code:</p>
  
  <pre><code>UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.mySubview.bounds
                                                byRoundingCorners:(UIRectCornerTopLeft | UIRectCornerTopRight | UIRectCornerBottomLeft | UIRectCornerBottomRight)
                                                      cornerRadii:CGSizeMake(10, 10)];
  
  CAShapeLayer *maskLayer = [CAShapeLayer layer];
  maskLayer.frame = self.mySubview.bounds;
  maskLayer.path = maskPath.CGPath;
  self.mySubview.layer.mask = maskLayer;
  </code></pre>
  
  <p>I have been doing research and trying to find a way to fix this so I can both set the mask layer and have the subview have it's correct height but I haven't been able to get it to work.</p>
  
  <p>I have seen this solution recommended several times now:</p>
  
  <pre><code>[self setNeedLayout];
  [self layoutIfNeeded];
  // Customize cell after here
  </code></pre>
  
  <p>But this doesn't work for me either. Is there a way for me to know when the Auto Layout constraints have been applied so that I can then apply the mask layer afterwards? </p>
  
  <p>The mask layer code is really simple, it uses the bounds of the subview, and the bounds are off because it's using the bounds that exist before the constraints have been applied and the subview has the correct height. At least I think I'm understanding that correctly.</p>