Animate UIView like if it comes closer or moving away

喜你入骨 提交于 2019-12-08 11:17:20

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!