<bdo id='NCRb3'></bdo><ul id='NCRb3'></ul>
  1. <i id='NCRb3'><tr id='NCRb3'><dt id='NCRb3'><q id='NCRb3'><span id='NCRb3'><b id='NCRb3'><form id='NCRb3'><ins id='NCRb3'></ins><ul id='NCRb3'></ul><sub id='NCRb3'></sub></form><legend id='NCRb3'></legend><bdo id='NCRb3'><pre id='NCRb3'><center id='NCRb3'></center></pre></bdo></b><th id='NCRb3'></th></span></q></dt></tr></i><div id='NCRb3'><tfoot id='NCRb3'></tfoot><dl id='NCRb3'><fieldset id='NCRb3'></fieldset></dl></div>

    <legend id='NCRb3'><style id='NCRb3'><dir id='NCRb3'><q id='NCRb3'></q></dir></style></legend>
  2. <tfoot id='NCRb3'></tfoot>

    1. <small id='NCRb3'></small><noframes id='NCRb3'>

      如何处理不在 UINavigationController 堆栈顶部的 UIViewController 的旋转?

      时间:2023-06-12

    2. <tfoot id='VIGyc'></tfoot>
      <i id='VIGyc'><tr id='VIGyc'><dt id='VIGyc'><q id='VIGyc'><span id='VIGyc'><b id='VIGyc'><form id='VIGyc'><ins id='VIGyc'></ins><ul id='VIGyc'></ul><sub id='VIGyc'></sub></form><legend id='VIGyc'></legend><bdo id='VIGyc'><pre id='VIGyc'><center id='VIGyc'></center></pre></bdo></b><th id='VIGyc'></th></span></q></dt></tr></i><div id='VIGyc'><tfoot id='VIGyc'></tfoot><dl id='VIGyc'><fieldset id='VIGyc'></fieldset></dl></div>

      <small id='VIGyc'></small><noframes id='VIGyc'>

        <bdo id='VIGyc'></bdo><ul id='VIGyc'></ul>
          <tbody id='VIGyc'></tbody>
            <legend id='VIGyc'><style id='VIGyc'><dir id='VIGyc'><q id='VIGyc'></q></dir></style></legend>
              • 本文介绍了如何处理不在 UINavigationController 堆栈顶部的 UIViewController 的旋转?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我在 UINavigationController 中有一个根 UIViewController (VC1),它通过在 willRotateToInterfaceOrientation: 方法中手动调整其视图/子视图帧来处理旋转.如果根 UIViewController 是活动视图控制器,则旋转工作正常,基本上位于堆栈顶部.

                I have a root UIViewController (VC1), inside a UINavigationController, which handles rotation by adjusting its views/subviews frames manually in the willRotateToInterfaceOrientation: method. The rotation works fine if the root UIViewController is the active view controller, basically on top of the stack.

                当我将另一个 UIViewController (VC2) 推到 NavigationController 上时,就会出现问题.然后我旋转VC2,它工作正常.但是,当我弹出 VC2 时,问题是 VC1 没有旋转到正确的方向,它的 willRotateToInterfaceOrientation: 方法也没有被调用?VC1 中的 shouldAutorotateToInterfaceOrientation: 方法被调用,仅此而已.

                The problem occurs when i push another UIViewController (VC2) onto the NavigationController. I then rotate VC2 which works fine. However when i pop VC2 the problem is that VC1 has not rotated to the correct orientation, nor does its willRotateToInterfaceOrientation: method get called?? The shouldAutorotateToInterfaceOrientation: method in VC1 is called but thats it.

                那么我的问题是我应该如何确保我的 UIViewController VC1 已经针对这种情况的当前方向进行了更新??

                My question then is how am i supposed to make sure that my UIViewController VC1 has been updated for the current orientation for this type of situation??

                推荐答案

                我解决这个问题的方法是检查 viewWillAppear: 看现在的方向是否与 viewDidDisappear 被调用.如果是这样,我调用代码来布局视图.

                The way I resolve this is to check on viewWillAppear: to see if the orientation is now different to when viewDidDisappear was called. If so I call the code to layout the view.

                要采用这种方法,首先将负责布局视图的代码分解为类似 _layoutViews 的代码,可以在 viewWillAppear 中简单地调用它>willRotateToInterfaceOrientation:.

                To adopt this approach first factor the code responsible for laying out the view into something like _layoutViews, can simply call it as required in viewWillAppear as well as in willRotateToInterfaceOrientation:.

                这篇关于如何处理不在 UINavigationController 堆栈顶部的 UIViewController 的旋转?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:UINavigationController 与 presentModalViewController 下一篇:选项卡式导航视图的正确设计模式?

                相关文章

                    <i id='4Tx2C'><tr id='4Tx2C'><dt id='4Tx2C'><q id='4Tx2C'><span id='4Tx2C'><b id='4Tx2C'><form id='4Tx2C'><ins id='4Tx2C'></ins><ul id='4Tx2C'></ul><sub id='4Tx2C'></sub></form><legend id='4Tx2C'></legend><bdo id='4Tx2C'><pre id='4Tx2C'><center id='4Tx2C'></center></pre></bdo></b><th id='4Tx2C'></th></span></q></dt></tr></i><div id='4Tx2C'><tfoot id='4Tx2C'></tfoot><dl id='4Tx2C'><fieldset id='4Tx2C'></fieldset></dl></div>
                      <bdo id='4Tx2C'></bdo><ul id='4Tx2C'></ul>
                    <legend id='4Tx2C'><style id='4Tx2C'><dir id='4Tx2C'><q id='4Tx2C'></q></dir></style></legend>
                    <tfoot id='4Tx2C'></tfoot>

                    <small id='4Tx2C'></small><noframes id='4Tx2C'>