title: NSAttributedString background color and rounded corners
body: <p>I have a question regarding rounded corners and text background color for a custom <code>UIView</code>.</p>
  
  <p>Basically, I need to achieve an effect like this (image attached - notice the rounded corners on one side) in a custom UIView:
  <img src="https://i.stack.imgur.com/BxJq5.png" alt="Background highlight"></p>
  
  <p>I'm thinking the approach to use is:</p>
  
  <ul>
  <li>Use Core Text to get glyph runs.</li>
  <li>Check highlight range.</li>
  <li>If the current run is within the highlight range, draw a background rectangle with rounded corners and desired fill color before drawing the glyph run.</li>
  <li>Draw the glyph run.</li>
  </ul>
  
  <p>However, I'm not sure whether this is the only solution (or for that matter, whether this is the most efficient solution).</p>
  
  <p>Using a <code>UIWebView</code> is not an option, so I have to do it in a custom <code>UIView</code>.</p>
  
  <p>My question being, is this the best approach to use, and am I on the right track? Or am I missing out something important or going about it the wrong way?</p>