动画 UIView 就像它靠近或移动一样 [英] Animate UIView like if it comes closer or moving away

查看:30
本文介绍了动画 UIView 就像它靠近或移动一样的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到了这个线程,但解决方案不是我要找的.

我想弹出一个带有动画的 UIView,类似于应用程序从 SpringBoard 出现的方式(似乎它更近了)并使其消失并移开.我试图为框架设置动画,但结果是内容没有调整大小:不幸的是,我无法为视图的内容分配约束;结果应该是,如果视图以正确的尺寸显示并且只调整了图形上下文"的大小.

帮助!

解决方案

这从 10% 的大小开始,变成 100% 的视图大小

view.transform = CGAffineTransformScale(view.transform, 0.1, 0.1);[UIView animateWithDuration:0.35 动画:^{view.transform = CGAffineTransformScale(view.transform, 1.0, 1.0);}完成:^(BOOL完成){}];

还要记得#import

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!

解决方案

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>

这篇关于动画 UIView 就像它靠近或移动一样的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆