title: Very Simple Custom UIView, drawRect not getting called
body: <p>I have this super simple example, and I'm not sure why it is not working. drawRect Never gets called. I just want a square to draw and be red. What am I doing wrong?</p>
  
  <pre class="lang-objective-c prettyprint-override"><code>//Controller.h
  
  #import &lt;Foundation/Foundation.h&gt;
  @class CustomView;
  
  @interface Controller : NSObject
  @property (nonatomic, retain) CustomView *cv;
  @end
  
  //Controller.m
  #import "Controller.h"
  #import "CustomView.h"
  
  @implementation Controller
  @synthesize cv;
  
  - (void) awakeFromNib {
  NSLog(@"awakeFromNib called");
  
  CGRect theFrame = CGRectMake(20, 20, 100, 100);
  cv = [[CustomView alloc] initWithFrame:theFrame];
  
  UIWindow *theWindow = [[UIApplication sharedApplication] keyWindow];
  [theWindow addSubview:cv];
  [cv setNeedsDisplay];
  }
  @end
  
  //CustomView.h
  #import &lt;UIKit/UIKit.h&gt;
  @interface CustomView : UIView
  @end
  
  //CustomView.m
  #import "CustomView.h"
  
  @implementation CustomView
  
  - (id)initWithFrame:(CGRect)frame {
  self = [super initWithFrame:frame];
  if (self) {
  NSLog(@"initWithFrame called");
  }
  return self;
  }
  
  - (void)drawRect:(CGRect)rect {
  NSLog(@"drawRect called");
  self.backgroundColor = [UIColor redColor];
  }
  @end
  </code></pre>