title: CAShapeLayer Shadow with UIBezierPath
body: <p>This question continues from a <a href="https://stackoverflow.com/questions/28497384/cashapelayer-shadow">previous answer</a>.</p>
  
  <p>I have the following <code>CAShapeLayer</code>:</p>
  
  <pre><code>- (CAShapeLayer *)gaugeCircleLayer {
  
      if (_gaugeCircleLayer == nil) {
          _gaugeCircleLayer = [CAShapeLayer layer];
          _gaugeCircleLayer.lineWidth = self.gaugeWidth;
          _gaugeCircleLayer.fillColor = [UIColor clearColor].CGColor;
          _gaugeCircleLayer.strokeColor = self.gaugeTintColor.CGColor;
          _gaugeCircleLayer.strokeStart = 0.0f;
          _gaugeCircleLayer.strokeEnd = self.value;
          _gaugeCircleLayer.lineCap = kCALineCapRound;
          _gaugeCircleLayer.path = [self insideCirclePath].CGPath;
  
          CAShapeLayer *cap = [CAShapeLayer layer];
          cap.shadowColor = [UIColor blackColor].CGColor;
          cap.shadowRadius = 8.0;
          cap.shadowOpacity = 0.9;
          cap.shadowOffset = CGSizeMake(0, 0);
          cap.fillColor = [UIColor grayColor].CGColor;
          [_gaugeCircleLayer addSublayer:cap];
      }
  
      return _gaugeCircleLayer;
  }
  </code></pre>
  
  <p>Then I have the following <code>UIBezierPath</code>:</p>
  
  <pre><code>- (UIBezierPath *)insideCirclePath {
  
      CGPoint arcCenter = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds));
      UIBezierPath *path = [UIBezierPath bezierPathWithArcCenter:arcCenter
                                                          radius:CGRectGetWidth(self.bounds) / 2.0f
                                                      startAngle:(3.0f * M_PI_2)
                                                        endAngle:(3.0f * M_PI_2) + (2.0f * M_PI)
                                                       clockwise:YES];
  
  
      return path;
  }
  </code></pre>
  
  <p>This produces something like the following:</p>
  
  <p><img src="https://i.stack.imgur.com/ctmT4.png" alt="enter image description here"></p>
  
  <p>What I am trying to produce with the <code>cap</code> sublayer is the drop shadow at the end and I'd also be interested to know how to get a GradientLayer working similar to the image below:</p>
  
  <p><img src="https://i.stack.imgur.com/E7Cjj.jpg" alt="enter image description here"></p>
  
  <p>The problem is that the sublayer is not appearing anywhere and I'm not quite sure why. I'm also not 100% sure on whether or not this is the best way to produce the desired effect.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>The following bit of code <a href="https://stackoverflow.com/questions/28497384/cashapelayer-shadow">creates a cap</a>, though I'm not quite sure how to add it to my <code>UIBezierPath</code> properly:</p>
  
  <pre><code>let cap = CAShapeLayer()
  cap.shadowColor = UIColor.blackColor().CGColor
  cap.shadowRadius = 8.0
  cap.shadowOpacity = 0.9
  cap.shadowOffset = CGSize(width: 0, height: 0)
  cap.path = UIBezierPath(ovalInRect: CGRectMake(0, 40, 20, 20)).CGPath
  cap.fillColor = UIColor.grayColor().CGColor
  layer.addSublayer(cap)
  </code></pre>