title: Delegate method drawLayer: inContext not called
body: <p>I'm struggling to find the missing piece in my code.I have a class which derives from UIView(customView) and also have a class that derives from CALayer (customLayer) and implements the drawLayer:inContext delegate method of the CALayer class.I do that because I want to use the customLayer as a clipping mask and so I need the drawLayer: inContext method which is not called when I start the application.
  Here is a snippet of my code</p>
  
  <pre><code>@implementation CustomView
  
  - (id)initWithFrame:(CGRect)frame
  {
      self = [super initWithFrame:frame];
      if (self) {
          self.backgroundColor = [UIColor lightGrayColor]; 
          // Initialization code
          CustomLayer *customLayer= [CALayer layer];     
          customLayer.backgroundColor= [UIColor colorWithRed:0 green:0.6 blue:0.2  alpha:0.4].CGColor;
          customLayer.frame = self.bounds;
          customLayer.delegate=customLayer;
          [customLayer setNeedsDisplay];
          [self.layer addSublayer:customLayer];
       }
    return self;
  }
  </code></pre>
  
  <p>and the customLayer implementation:</p>
  
  <pre><code>@implementation CustomLayer
  
  -(void) drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx
  {
      NSLog(@"drawLayer:inContext");
      CGContextBeginPath (ctx);
      CGContextAddEllipseInRect(ctx, self.frame);
      CGContextClosePath (ctx);
      CGContextClip (ctx);
  }
  </code></pre>
  
  <p>I really can't figure out what is going on.Any advices will be greatly appreciated.</p>