• <bdo id='GIPlw'></bdo><ul id='GIPlw'></ul>

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

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

      1. <legend id='GIPlw'><style id='GIPlw'><dir id='GIPlw'><q id='GIPlw'></q></dir></style></legend>
      2. 如何检测是否从导航控制器弹出视图控制器?

        时间:2023-06-13
        1. <i id='JrAFN'><tr id='JrAFN'><dt id='JrAFN'><q id='JrAFN'><span id='JrAFN'><b id='JrAFN'><form id='JrAFN'><ins id='JrAFN'></ins><ul id='JrAFN'></ul><sub id='JrAFN'></sub></form><legend id='JrAFN'></legend><bdo id='JrAFN'><pre id='JrAFN'><center id='JrAFN'></center></pre></bdo></b><th id='JrAFN'></th></span></q></dt></tr></i><div id='JrAFN'><tfoot id='JrAFN'></tfoot><dl id='JrAFN'><fieldset id='JrAFN'></fieldset></dl></div>
            1. <tfoot id='JrAFN'></tfoot>
            2. <small id='JrAFN'></small><noframes id='JrAFN'>

              <legend id='JrAFN'><style id='JrAFN'><dir id='JrAFN'><q id='JrAFN'></q></dir></style></legend>
                <tbody id='JrAFN'></tbody>

                  <bdo id='JrAFN'></bdo><ul id='JrAFN'></ul>

                  本文介绍了如何检测是否从导航控制器弹出视图控制器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  当顶视图控制器从我的导航控制器中弹出时,我目前需要实现一些代码.有没有办法检测视图控制器何时从导航控制器堆栈中弹出?

                  我想尽可能避免使用 viewWillDisappearviewDidDisappear 因为我在我的项目中使用了 splitview,并且在主视图中选择不同的行也会触发 viewWillDisappear/viewDidDisappear 方法.

                  解决方案

                  您可以使用视图控制器的 isMovingFromParentViewController 属性来检测视图是否正在弹出,如下所示:

                  - (void)viewWillDisappear:(BOOL)animated{[超级viewWillDisappear:动画];if ([self isMovingFromParentViewController]){NSLog(@"视图控制器被弹出");}别的{NSLog(@"新的视图控制器被推送");}}

                  <块引用>

                  isMovingFromParentViewController

                  返回一个布尔值,表示视图控制器在从父级中移除的过程.

                  I currently need to implement some code when the top view controller is being popped off from my navigation controller. Is there a way to detect when the view controller is being popped off the navigation controller stack?

                  As much as possible I want to stay away from using viewWillDisappear or viewDidDisappear because I'm using a splitview in my project, and selecting a different row in the master view will also trigger the viewWillDisappear/viewDidDisappear methods.

                  解决方案

                  You can detect whether a view is being popped using the isMovingFromParentViewController property for a view controller as shown below:

                  - (void)viewWillDisappear:(BOOL)animated
                  {
                      [super viewWillDisappear:animated];
                      if ([self isMovingFromParentViewController])
                      {
                          NSLog(@"View controller was popped");
                      }
                      else
                      {
                          NSLog(@"New view controller was pushed");
                      }
                  }
                  

                  isMovingFromParentViewController

                  Returns a Boolean value that indicates that the view controller is in the process of being removed from its parent.

                  这篇关于如何检测是否从导航控制器弹出视图控制器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:UINavigationBar 在推送时更改颜色 下一篇:具有透明内容的 ios 7 视图与以前的视图重叠

                  相关文章

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

                  <tfoot id='NBvK9'></tfoot>

                    <bdo id='NBvK9'></bdo><ul id='NBvK9'></ul>

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