Arlen Anderson Arlen Anderson - 1 year ago 252
iOS Question

Disable orientation change rotation animation

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.

Answer Source

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.

Clear as mud, no?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download