title: iOS add / remove shadow from a view
body: <p>I do not understand how to remove a shadow that was added to a view.
  I add to my view in <code>initWithFrame</code> a shadow in this way:</p>
  
  <pre><code>self.layer.borderWidth = 2;
  self.layer.borderColor = [UIColor clearColor].CGColor;
  self.backgroundColor = [UIColor greenColor];
  [self.layer setCornerRadius:8.0f];
  CALayer *layer = self.layer;
  layer.shadowOffset = CGSizeMake(2, 2);
  layer.shadowColor = [[UIColor blackColor] CGColor];
  layer.cornerRadius = 8.0f;
  layer.shadowRadius = 3.0f;
  layer.shadowOpacity = 0.80f;
  layer.shadowPath = [[UIBezierPath bezierPathWithRect:layer.bounds] CGPath];
  </code></pre>
  
  <p>After in the execution of the app I want to remove the shadow from this view. I've tried using:</p>
  
  <pre><code>layer.hidden = YES;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>self.layer.hidden = YES;
  </code></pre>
  
  <p>but this hides the view completely, not just the added shadow.</p>
  
  <p>Is there a way to retrieve the added shadow from a view and then hide it?
  Thanks!</p>