title: SubClassing UILabel
body: <p>I read in this same site how to inset and UILabel (subclass UILabel and override the required methods). Before adding it to my app I decided to test it out in a standalone test app. Code is shown below.</p>
  
  <p><strong>Here's MyUILabel.h</strong></p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  
  @interface MyUILabel : UILabel
  
  @end
  </code></pre>
  
  <p><strong>Here's MyUILabel.m</strong></p>
  
  <pre><code>#import "MyUILabel.h"
  #import &lt;QuartzCore/QuartzCore.h&gt;
  
  @implementation MyUILabel
  
  - (id)initWithFrame:(CGRect)frame
  {
      self = [super initWithFrame:frame];
      if (self) {
          // Initialization code
      }
      return self;
  }
  
  // for border and rounding
  -(void) drawRect:(CGRect)rect
  {
      self.layer.cornerRadius = 4.0;
      self.layer.borderWidth = 2;
  
      [super drawRect:rect];
  }
  
  // for inset
  -(void) drawTextInRect:(CGRect)rect
  {
      UIEdgeInsets insets = {0, 5, 0, 5};
  
      [super drawTextInRect: UIEdgeInsetsInsetRect(rect, insets)];
  }
  </code></pre>
  
  <p><strong>Here's my ViewController.h</strong></p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  #import "MyUILabel.h"
  
  
  @interface ViewController : UIViewController
  {
      MyUILabel   *myDisplay;
  }
  
  @property (strong, nonatomic) IBOutlet MyUILabel *myDisplay;
  
  @end
  </code></pre>
  
  <p><strong>Here's ViewController.m:</strong></p>
  
  <pre><code>#import "ViewController.h"
  
  @interface ViewController ()
  
  @end
  
  @implementation ViewController
  
  @synthesize myDisplay;
  
  - (void)viewDidLoad
  {
      [super viewDidLoad];
      // Do any additional setup after loading the view, typically from a nib.
  
      myDisplay.text = @"Hello World!";
  }
  
  - (void)viewDidUnload
  {
      [self setMyDisplay:nil];
      [super viewDidUnload];
      // Release any retained subviews of the main view.
  }
  
  - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
  {
      return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
  }
  
  @end
  </code></pre>
  
  <p>None of the methods in MyUILabel.m (that Im overriding) get called.</p>
  
  <p>Insights into why are greatly appreciated.</p>
  
  <p>Regards,</p>
  
  <p>Ramon.</p>