iOS:旋转iPad,在什么阶段改变视图?

iOS:旋转iPad,在什么阶段改变视图?,ios,ipad,cocoa-touch,screen-rotation,Ios,Ipad,Cocoa Touch,Screen Rotation,我的应用程序对于每个方向都有非常不同的UI结构 在iPad的旋转生命周期中,我应该在哪个阶段删除,然后添加方向的UI以确保最平稳的过渡?在处理自动旋转时,您需要注意4种主要方法: shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interface

我的应用程序对于每个方向都有非常不同的UI结构


在iPad的旋转生命周期中,我应该在哪个阶段删除,然后添加方向的UI以确保最平稳的过渡?

在处理自动旋转时,您需要注意4种主要方法:

shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation                                   duration:(NSTimeInterval)duration

willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
                            duration:(NSTimeInterval)duration

didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
现在,我处理旋转的方式是,例如:

  • 调整
    WillAnimateRotationInterfaceOrientation
    中的所有帧

  • willRotateToInterfaceOrientation
    中添加/删除子视图(如果需要)

  • didRotateFromInterfaceOrientation
    中恢复子视图(如果需要)

  • 更一般地说,我修改了
    willAnimateRotationInterfaceOrientation
    中可设置动画的所有属性;当我在
    中执行所有不可设置动画的修改时,将旋转到InterfaceOrientation
    /
    didRotateFromInterfaceOrientation

    这是关于
    willRotate
    /
    didRotate
    的说明:

    要临时关闭不需要的功能或在方向更改期间可能导致问题的功能,可以覆盖willRotateToInterfaceOrientation:duration:方法并在其中执行所需的操作。然后,您可以重写didRotateFromInterfaceOrientation:方法,并在方向更改完成后使用它重新启用这些功能


    处理自动旋转时,您需要注意4种主要方法:

    shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
    
    willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation                                   duration:(NSTimeInterval)duration
    
    willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
                                duration:(NSTimeInterval)duration
    
    didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
    
    现在,我处理旋转的方式是,例如:

  • 调整
    WillAnimateRotationInterfaceOrientation
    中的所有帧

  • willRotateToInterfaceOrientation
    中添加/删除子视图(如果需要)

  • didRotateFromInterfaceOrientation
    中恢复子视图(如果需要)

  • 更一般地说,我修改了
    willAnimateRotationInterfaceOrientation
    中可设置动画的所有属性;当我在
    中执行所有不可设置动画的修改时,将旋转到InterfaceOrientation
    /
    didRotateFromInterfaceOrientation

    这是关于
    willRotate
    /
    didRotate
    的说明:

    要临时关闭不需要的功能或在方向更改期间可能导致问题的功能,可以覆盖willRotateToInterfaceOrientation:duration:方法并在其中执行所需的操作。然后,您可以重写didRotateFromInterfaceOrientation:方法,并在方向更改完成后使用它重新启用这些功能