问题
I saw this thread but the solution is not what I'm looking for.
I would like to pop up a UIView with an animation similar to how an app appears from the SpringBoard (it seems it comes closer) and make it disappear moving it away. I've tried to animate the frame, but the effect is that the content is not resized: unfortunately I cannot assign constraints to the content of the view; the result should be like if the view is shown with the correct sizes and only the "graphics context" is resized.
Help!
回答1:
This starts at 10% the size and turns to 100 % of the views size
view.transform = CGAffineTransformScale(view.transform, 0.1, 0.1);
[UIView animateWithDuration:0.35 animations:^{
view.transform = CGAffineTransformScale(view.transform, 1.0, 1.0);
} completion:^(BOOL finished) {
}];
also remember to #import <QuartzCore/QuartzCore.h>
回答2:
You can animate the transform.scale and opacity of the view's layer. See this answer for details: https://stackoverflow.com/a/3463362/550177
来源:https://stackoverflow.com/questions/13047130/animate-uiview-like-if-it-comes-closer-or-moving-away