I have a view that has a small popover mode placed at the bottom of the screen, and a full screen mode. When animating between the two, the size is changing immediately at the start of the animation.
For example, when changing from full screen to small mode, the footer of my view starts at the bottom, snaps up near the top, and then the whole (now shrunken) view animates down to where it belongs.
Instead, I want my footer to stay in (approximately) the same place. The bottom of the view should only move by a few pixels, and the top should do most of the moving.
I have tried setting both the frame, and the center/bounds but they both have the same effect. How can I animate this smoothly?
Below, method A and method B both result in the same, ugly animation regardless of direction (large->small/small->large).
CGRect bounds = newFrame;
bounds.origin = CGPointZero;
CGPoint center = CGRectGetCenter(newFrame);
[UIView animateWithDuration:0.75
delay:0.0
usingSpringWithDamping:0.7
initialSpringVelocity:0.0
options:UIViewAnimationOptionCurveEaseIn | UIViewAnimationOptionAllowUserInteraction
animations:^{
// Method A
view.frame = newFrame;
// Method B
view.center = center;
view.bounds = bounds;
}
completion:completion];