<tfoot id='G39ZI'></tfoot>

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

      • <bdo id='G39ZI'></bdo><ul id='G39ZI'></ul>
      <legend id='G39ZI'><style id='G39ZI'><dir id='G39ZI'><q id='G39ZI'></q></dir></style></legend>
      1. <small id='G39ZI'></small><noframes id='G39ZI'>

        如何检查视图控制器是否以模态方式呈现或推送到导航堆栈上?

        时间:2023-05-16
        <legend id='bI2rB'><style id='bI2rB'><dir id='bI2rB'><q id='bI2rB'></q></dir></style></legend>

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

                <tbody id='bI2rB'></tbody>
              <tfoot id='bI2rB'></tfoot>

                <bdo id='bI2rB'></bdo><ul id='bI2rB'></ul>
                  本文介绍了如何检查视图控制器是否以模态方式呈现或推送到导航堆栈上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  如何在我的视图控制器代码中区分:

                  How can I, in my view controller code, differentiate between:

                  • 模态呈现
                  • 推送到导航堆栈

                  presentingViewControllerisMovingToParentViewController 在这两种情况下都是 YES,所以不是很有帮助.

                  Both presentingViewController and isMovingToParentViewController are YES in both cases, so are not very helpful.

                  让事情变得复杂的是,我的父视图控制器有时是模态的,要检查的视图控制器被推送到它上面.

                  What complicates things is that my parent view controller is sometimes modal, on which the to be checked view controller is pushed.

                  原来我的问题是我将我的 HtmlViewController 嵌入到 UINavigationController 中,然后显示.这就是为什么我自己的尝试和下面的好答案都不起作用的原因.

                  It turns out my issue is that I embed my HtmlViewController in a UINavigationController which is then presented. That's why my own attempts and the good answers below were not working.

                  HtmlViewController*     termsViewController = [[HtmlViewController alloc] initWithDictionary:dictionary];
                  UINavigationController* modalViewController;
                  
                  modalViewController = [[UINavigationController alloc] initWithRootViewController:termsViewController];
                  modalViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
                  [self presentViewController:modalViewController
                                     animated:YES
                                   completion:nil];
                  

                  我想我最好告诉我的视图控制器什么时候是模态的,而不是试图确定.

                  I guess I'd better tell my view controller when it's modal, instead of trying to determine.

                  推荐答案

                  持保留态度,没有测试.

                  Take with a grain of salt, didn't test.

                  - (BOOL)isModal {
                       if([self presentingViewController])
                           return YES;
                       if([[[self navigationController] presentingViewController] presentedViewController] == [self navigationController])
                           return YES;
                       if([[[self tabBarController] presentingViewController] isKindOfClass:[UITabBarController class]])
                           return YES;
                  
                      return NO;
                   }
                  

                  这篇关于如何检查视图控制器是否以模态方式呈现或推送到导航堆栈上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何从 UINavigationController 弹出视图并在一次操作中将其替换为另一个视图? 下一篇:防止 UISearchDisplayController 隐藏导航栏

                  相关文章

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

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

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