title: UILabel with padding in Xamarin.iOS?
body: <p>I'm trying to create a <code>UILabel</code> with padding in my Xamarin.iOS app. The most popular solution in native Objective-C apps is overriding <code>drawTextInRect</code>:</p>
  
  <pre><code>- (void)drawTextInRect:(CGRect)rect {
      UIEdgeInsets insets = {0, 5, 0, 5};
      return [super drawTextInRect:UIEdgeInsetsInsetRect(rect, insets)];
  }
  </code></pre>
  
  <p>As simple as this seems, I can't quite figure out how to translate it to C#. Here's my best stab at it:</p>
  
  <pre><code>internal class PaddedLabel : UILabel
  {
      public UIEdgeInsets Insets { get; set; }
  
      public override void DrawText(RectangleF rect)
      {
          var padded = new RectangleF(rect.X + Insets.Left, rect.Y, rext.Width + Insets.Left + Insets.Right, rect.Height);
  
          base.DrawText(padded);
      }
  }
  </code></pre>
  
  <p>This does seem to move the label's text, but it doesn't resize the label.</p>
  
  <p>I think the main issue is that I can't find the Xamarin equivalent of <code>UIEdgeInsetsInsetRect</code>. </p>
  
  <p>Any suggestions?</p>