title: apply clear color in CALayer
body: <p>How to apply in clear color in this circular UIView in the region covered in green, or the white color in the center will be faded from the center.</p>
  
  <p><img src="https://i.stack.imgur.com/OO7gr.png" alt="enter image description here"></p>
  
  <p><strong>Here is the code:-</strong></p>
  
  <pre><code>   UIView *vwx=[[UIView alloc]initWithFrame:CGRectMake(150, self.view.frame.size.height/2, 100, 100)];
  
      vwx.layer.cornerRadius = 50;
      vwx.layer.masksToBounds = YES;
      CircleGradient *gradientLayer = [CircleGradient new];
      gradientLayer.frame = vwx.bounds;
  
      [vwx.layer addSublayer:gradientLayer];
      [self.view addSubview:vwx];
  </code></pre>
  
  <p>This is what I have done in sub-classing CALayer</p>
  
  <pre><code>- (void)drawInContext:(CGContextRef)ctx
  {
  
      size_t gradLocationsNum = 2;
      CGFloat gradLocations[2] = {0.0f, 1.0f};
      CGFloat gradColors[3] = {0.0f,0.0f,0.0f};
      CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
      CGGradientRef gradient = CGGradientCreateWithColorComponents(colorSpace, gradColors, gradLocations, gradLocationsNum);
      CGColorSpaceRelease(colorSpace);
  
      CGPoint gradCenter= CGPointMake(self.bounds.size.width/2, self.bounds.size.height/2);
      float gradRadius = MIN(self.bounds.size.width , self.bounds.size.height) ;
  
      CGContextDrawRadialGradient (ctx, gradient, gradCenter, 0, gradCenter, gradRadius, kCGGradientDrawsAfterEndLocation);
  
  
      CGGradientRelease(gradient);
  }
  </code></pre>
  
  <p>Any help or suggestion will be helpful</p>