title: UIView: How to animate CALayer frame with shadow?
body: <p>I added a shadow layer as a sublayer to UIView's layer. Following is an added method for <code>UIView</code> subclass:</p>
  
  <pre><code>- (void)addDefaultShadowSubview {
      self.shadowSubview = [[[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, self.frame.size.width, self.frame.size.height)] autorelease];
  
      CALayer *shadowLayer = [CALayer layer];
      shadowLayer.backgroundColor = self.backgroundColor.CGColor;
      shadowLayer.shadowOffset = CGSizeMake(0, 3);
      shadowLayer.shadowRadius = 5.0;
      shadowLayer.shadowColor = [UIColor blackColor].CGColor;
      shadowLayer.shadowOpacity = 0.8;
  
      shadowLayer.frame = self.shadowSubview.frame;
  
      [self.shadowSubview.layer addSublayer:shadowLayer];
  
      self.shadowSubview.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
  
      [self addSubview:self.shadowSubview];
      [self sendSubviewToBack:self.shadowSubview];
  }
  </code></pre>
  
  <p>I would like to keep it as a part of resizing animation of the an <code>UIView</code> with shadowSubview. But can't find the right way to do it while using <code>+ (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion;</code></p>
  
  <pre><code>[UIView animateWithDuration:durationDefaultAnimation
                       animations:^{
                           [self.viewWithShadowSubview setFrame:enlargedFrame];
                       }
                       completion:^(BOOL finished) {
                           [self modifyInsetForCurrentImageviewWithAnimation:YES];
                       }];
  </code></pre>
  
  <p>Please help me to know to right way. Tried to learn about <code>CABasicAnimation</code>, but can't find the way to apply it to this case.</p>