title: iOS: Draw shadow within UIView
body: <p>I found some great code that is a subclass of <code>UIView</code> which draws that view with a shadow.  Then I can use that view anywhere I want to place the shadow:</p>
  
  <pre><code>-(void) layoutSubviews {
      CGFloat coloredBoxMargin = 40;
      CGFloat coloredBoxHeight = self.frame.size.height;
      _coloredBoxRect = CGRectMake(coloredBoxMargin, 0, 40, coloredBoxHeight);
  }
  
  -(void) drawRect:(CGRect)rect {
  
      CGColorRef lightColor =  [UIColor colorWithRed:105.0f/255.0f green:179.0f/255.0f blue:216.0f/255.0f alpha:0.8].CGColor;
      CGColorRef shadowColor = [UIColor colorWithRed:0.2 green:0.2 blue:0.2 alpha:0.4].CGColor;   
  
      CGContextRef context = UIGraphicsGetCurrentContext();
      // Draw shadow
      CGContextSaveGState(context);
      CGContextSetFillColorWithColor(context, lightColor);
      CGContextSetShadowWithColor(context, CGSizeMake(-13, 0), 10, shadowColor);
  
      CGContextFillRect(context, _coloredBoxRect);
      CGContextRestoreGState(context);
  }
  </code></pre>
  
  <p>Created using the following:</p>
  
  <pre><code>UIViewWithShadowRight* verticalLineView2 = [[[UIViewWithShadowRight alloc] initWithFrame:CGRectMake(60, 0, 40 , self.view.frame.size.height)] autorelease];
  [verticalLineView2 setBackgroundColor:[UIColor clearColor]];
  [verticalLineView2 setAutoresizingMask:UIViewAutoresizingFlexibleHeight];
  [verticalLineView2 setClipsToBounds:NO];
  [self.view addSubview:verticalLineView2];
  [self.view bringSubviewToFront:verticalLineView2];
  </code></pre>
  
  <p><strong>Problem is, the shadow is drawn from right to left, how can I reverse this and draw it left to right?</strong></p>