Disable orientation change rotation animation

后端 未结 5 2163
南方客
南方客 2020-12-01 00:50

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 s

5条回答
  •  自闭症患者
    2020-12-01 01:24

    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?

提交回复
热议问题