title: UIBezierPath Subtract Path
body: <p>By using <code>[UIBezierPath bezierPathWithRoundedRect:byRoundingCorners:cornerRadii:]</code>, I am able to create a rounded view, such as this:</p>
  
  <p><img src="https://i.stack.imgur.com/kh8HY.png" alt="rounded view"></p>
  
  <p>How could I subtract another path from this one (or some other way), to create a path like this:</p>
  
  <p><img src="https://i.stack.imgur.com/Rb82R.png" alt="subtracted view"></p>
  
  <p>Is there any way I can do something like this?
  Pseudocode:</p>
  
  <pre><code>UIBezierPath *bigMaskPath = [UIBezierPath bezierPathWithRoundedRect:bigView.bounds 
                                   byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)
                                         cornerRadii:CGSizeMake(18, 18)];
  UIBezierPath *smallMaskPath = [UIBezierPath bezierPathWithRoundedRect:smalLView.bounds 
                                       byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)
                                             cornerRadii:CGSizeMake(18, 18)];
  
  UIBezierPath *finalPath = [UIBezierPath pathBySubtractingPath:smallMaskPath fromPath:bigMaskPath];
  </code></pre>