title: How to make change the arrow direction of this UIBezierPath
body: <p>I have the following code which draws a rounded rect with a small caret arrow on the top. I want to be able to create a method that either draws the arrow at the top, left, right, or bottom depending on what I specify (I'll likely pass in an enum typedef).</p>
  
  <p>Here is what my code generates right now:</p>
  
  <p><img src="https://i.stack.imgur.com/ERiQA.png" alt="enter image description here"></p>
  
  <p>Can anyone help me make this code more dynamic/flexible so I can accomplish this?</p>
  
  <pre><code>        CGContextBeginPath(context);
          CGContextMoveToPoint(context, kBubbleBorderRadius + 0.5f, kCaretHeight + 0.5f);
          CGContextAddLineToPoint(context, round(currentFrame.size.width / 2.0f - (kCaretHeight * 2.0) / 2.0f) + 0.5f, kCaretHeight + 0.5f);
          CGContextAddLineToPoint(context, round(currentFrame.size.width / 2.0f) + 0.5f, 0.5f);
          CGContextAddLineToPoint(context, round(currentFrame.size.width / 2.0f + (kCaretHeight * 2.0) / 2.0f) + 0.5f, kCaretHeight + 0.5f);
          CGContextAddArcToPoint(context, currentFrame.size.width - 0.5f, kCaretHeight + 0.5f, currentFrame.size.width- 0.5f, currentFrame.size.height - 0.5f, kBubbleBorderRadius);
          CGContextAddArcToPoint(context, currentFrame.size.width - 0.5f, currentFrame.size.height - 0.5f, round(currentFrame.size.width / 2.0f + (kCaretHeight * 2.0) / 2.0f) + 0.5f, currentFrame.size.height - 0.5f, kBubbleBorderRadius);
          CGContextAddArcToPoint(context, 0.5f, currentFrame.size.height - 0.5f, 0.5f, kCaretHeight + 0.5f, kBubbleBorderRadius);
          CGContextAddArcToPoint(context, 0.5f, kCaretHeight + 0.5f, currentFrame.size.width - 0.5f, kCaretHeight + 0.5f, kBubbleBorderRadius);
          CGContextClosePath(context);
          CGContextDrawPath(context, kCGPathFill);
  </code></pre>