title: Resizing a UILabel to accommodate insets
body: <p>I'm building a screen to scan barcodes, and I need to put a translucent screen behind some <code>UILabels</code> to improve visibility against light backgrounds.</p>
  
  <p>Here's what the screen looks like now:</p>
  
  <p><img src="https://i.stack.imgur.com/jOMKt.png" alt="enter image description here"></p>
  
  <p>I'm setting the background color on the <code>UILabel</code> to get the translucent boxes. I've also created a custom <code>UILabel</code> subclass to allow me to set some padding between the edge of the <code>UILabel</code> and the text using <a href="https://stackoverflow.com/questions/3476646/uilabel-text-margin">this approach</a>.</p>
  
  <p>As you can see in the screen above, the <code>UILabel</code> doesn't resize correctly to take the padding into account. The "padding" just shifts the text over without changing the width of the label, causing the text to truncate.</p>
  
  <p>Both of these labels will contain text of arbitrary lengths, and I really need the <code>UILabel</code> to dynamically resize.</p>
  
  <p>What <code>UILabel</code> method can I override to increase the width of the label and factor in the padding?</p>