title: Objective C: Implementing drawRect
body: <p>I have a very simple project that involves drawing a shape with drawRect, but I don't believe my drawRect function is actually being called.  Here is the code. (Everything else is just the default for a "Single View Application.")</p>
  
  <pre><code>-(void)drawRect:(CGRect)aRect{
      NSLog(@"testing...");
      CGContextRef context=UIGraphicsGetCurrentContext();
      CGContextBeginPath(context);
      CGContextMoveToPoint(context, 50, 50);
      CGContextAddLineToPoint(context, 100, 120);
      CGContextAddLineToPoint(context, 20, 100);
      CGContextClosePath(context);
  
      [[UIColor greenColor] setFill];
      [[UIColor redColor] setStroke];
  
      CGContextDrawPath(context,kCGPathFillStroke);
  }
  
  - (void)viewDidLoad
  {
      [super viewDidLoad];
      [self.view setNeedsDisplay];
  }
  </code></pre>
  
  <p>Any advice would be terrific—thanks for reading!</p>