[UIView animateWithDuration: .2
animations:
^{
#if K_ANIMATE_FRAME
//Note that changing the frame will only work if the view redraws itself at the
//new size. UIImageView can be set up that way,
//but other view types may not.
viewToExpand.frame = containerView.frame;
#else
//An alternate approach is to apply a scale to the view's transform:
CGFloat scale = containerView.frame.size.width /
viewToExpand.frame.frame.size.width;
viewToExpand.transform = CGAffineTransformMakeScale(scale, scale);
#endif
//Now animate the container view off-screen
CGPoint center = containerView.center;
//Shift the container view left.
center.x -= containerView.bounds.size.width;
containerView.center = center;
}
];