title: iOS - Create UIView subclass for rounded rectangle
body: <p>I'm trying to create &amp; use a very simple UIView subclass for a rectangle with rounded corners.  I've created a new class as follows :</p>
  
  <p>RoundedRect.h</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  #import &lt;QuartzCore/QuartzCore.h&gt;
  
  @interface RoundedRect : UIView
  @end
  </code></pre>
  
  <p>RoundedRect.m</p>
  
  <pre><code>#import "RoundedRect.h"
  
  @implementation RoundedRect
  
  - (id)initWithFrame:(CGRect)frame
  {
      self = [super initWithFrame:frame];
      if (self) {
          // Initialization code
          [[self layer] setCornerRadius:10.0f];
          [[self layer] setMasksToBounds:YES];
      }
      return self;
  }
  @end
  </code></pre>
  
  <p>I'm using iOS 5.1 with storyboards and have set the custom class property in the IB inspector window to 'RoundedRect', but when I run the app the rectangle still has square corners.  Have I missed something obvious?</p>
  
  <p>Thanks
  Jonathan</p>