title: How do I draw a shadow under a UIView?
body: <p>I'm trying to draw a shadow under the bottom edge of a <code>UIView</code> in Cocoa Touch. I understand that I should use <code>CGContextSetShadow()</code> to draw the shadow, but the Quartz 2D programming guide is a little vague:</p>
  
  <ol>
  <li>Save the graphics state.</li>
  <li>Call the function <code>CGContextSetShadow</code>, passing the appropriate values.</li>
  <li>Perform all the drawing to which you want to apply shadows.</li>
  <li>Restore the graphics state</li>
  </ol>
  
  <p>I've tried the following in a <code>UIView</code> subclass:</p>
  
  <pre><code>- (void)drawRect:(CGRect)rect {
      CGContextRef currentContext = UIGraphicsGetCurrentContext();
      CGContextSaveGState(currentContext);
      CGContextSetShadow(currentContext, CGSizeMake(-15, 20), 5);
      CGContextRestoreGState(currentContext);
      [super drawRect: rect];
  }
  </code></pre>
  
  <p>..but this doesn't work for me and I'm a bit stuck about (a) where to go next and (b) if there's anything I need to do to my <code>UIView</code> to make this work?</p>