禁用方向改变旋转动画 [英] Disable orientation change rotation animation

查看:170
本文介绍了禁用方向改变旋转动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要禁用扮演的方向改变时的动画效果。这可能吗?如果没有,是否有可能加快步伐?

I need to disable the animation that plays when the orientation changes. Is this possible? If not, is it possible to speed it up?

只是为了澄清,我不想停止方向变化,只是动画。我想瞬间改变方向。

Just to clarify, i don't want to stop the orientation change, just the animation. I want an instant orientation change.

推荐答案

如果我没记错的话(这始终是诸如此类的事情,我玩弄了一下得到的权利) willRotateToInterfaceOrientation:持续时间: willAnimateRotationToInterfaceOrientation:时间:都是动画块内,而 didRotateFromInterfaceOrientation:在动画块后运行。我相信你会需要,使他们出现在他们将旋转后出现的位置布置在 willRotate 的意见的如果他们不旋转的(如果是有道理的)。这种方式的动画将从原来的(正确的)的布局中,该装置旋转方向相反的新的(旋转)布局制作动画,创造没有动画的外观。一旦转动完成后,您可以布置您的看法,没有动画,在 didRotate ,给IM pression,他们立刻转动。

If I remember correctly (this is always the sort of thing I have to play around with for a moment to get right) willRotateToInterfaceOrientation:duration: and willAnimateRotationToInterfaceOrientation:duration: are both inside the animation block, while didRotateFromInterfaceOrientation: runs after the animation block. I believe you would need to lay out your views in willRotate so they appear in the position in which they would appear after the rotation had they not rotated (if that makes sense). This way the animation will animate them from their original (correct) layout to the new (rotated) layout in the opposite direction that the device rotates, creating the appearance of no animation. Once the rotation is complete, you can lay out your views, without animation, in didRotate, giving the impression that they rotate instantly.

清除泥浆,不是吗?

这篇关于禁用方向改变旋转动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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