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

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

          <bdo id='F9GnA'></bdo><ul id='F9GnA'></ul>
        <tfoot id='F9GnA'></tfoot>
        <legend id='F9GnA'><style id='F9GnA'><dir id='F9GnA'><q id='F9GnA'></q></dir></style></legend>

        视图不在窗口层次结构中的 iOS

        时间:2023-06-12

        <tfoot id='CKi8h'></tfoot>

          <legend id='CKi8h'><style id='CKi8h'><dir id='CKi8h'><q id='CKi8h'></q></dir></style></legend>

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

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

                  本文介绍了视图不在窗口层次结构中的 iOS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  当我从 PassCode 控制器移动到 OTP ViewController 时,我在控制台中收到以下错误:

                  警告:尝试呈现 <OTPController: 0x1e56e0a0 > on 其视图不在窗口层次结构中!

                  Warning: Attempt to present < OTPController: 0x1e56e0a0 > on < PassCodeController: 0x1ec3e000> whose view is not in the window hierarchy!

                  这是我用来在视图之间切换的代码:

                  UIStoryboard  *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
                      OTPViewController *lOTPViewController = [storyboard instantiateViewControllerWithIdentifier:@"OTPViewController"];
                      lOTPViewController.comingFromReg = true;
                  
                      [self presentViewController:lOTPViewController animated:YES
                                       completion:nil];
                  

                  我正在从 RegistrationViewController 展示密码控制器:

                  UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
                          PassCodeViewController *passVC =  [storyboard instantiateViewControllerWithIdentifier:@"PassCodeViewController"];
                          [self presentViewController:passVC animated:YES completion:nil];
                  

                  推荐答案

                  这是因为两个viewcontroller同时存在和dismiss,或者你试图在viewcontroller打开时立即展示ViewController ViewDidload方法如此

                  That happen because of two viewcontroller present and dismiss at a same time or you are trying to present ViewController immediately at the viewcontroller open ViewDidload method so

                  第一:

                  • viewDidAppear 方法中呈现 ViewController 或代替 ViewDidload.
                  • Present ViewController from viewDidAppear Method or instead of ViewDidload.

                  第二:

                  我建议使用完成方法来呈现和关闭 viewcontrolelr,如下例所示:

                  I suggest to make use of completion method for present and dismiss viewcontrolelr like following example:

                  [self presentViewController:lOTPViewController animated:YES
                                               completion:^{
                  
                          }];
                  

                  更新:

                  创建一个显示 OTPViewController 的单独方法,如下所示:

                  Create a separate method of presenting a OTPViewController like following:

                  -(void)PresentOTPViewController
                  {
                  
                      UIStoryboard  *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
                      OTPViewController *lOTPViewController = [storyboard instantiateViewControllerWithIdentifier:@"OTPViewController"];
                      lOTPViewController.comingFromReg = true;
                  
                      [self presentViewController:lOTPViewController animated:YES
                                       completion:^{}];
                  
                  }
                  

                  现在使用 performSelector

                  [self performSelector:@selector(PresentOTPViewController) withObject:self afterDelay:1.0 ];
                  

                  你需要把上面的performselect代码放在

                  You need to put above performselect code in

                  [self dismissViewControllerAnimated:YES completion:^{
                   [self performSelector:@selector(PresentOTPViewController) withObject:self afterDelay:1.0 ];
                  }]; // this is the dismiss method of PassCodeViewController
                  

                  t

                  这篇关于视图不在窗口层次结构中的 iOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何停止弹出到导航控制器的标签栏的第二次点击? 下一篇:弹出动画在 UITabbarController 的第一个 UINavigationController 中不起作用

                  相关文章

                  <legend id='M0em8'><style id='M0em8'><dir id='M0em8'><q id='M0em8'></q></dir></style></legend>

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

                  <tfoot id='M0em8'></tfoot>
                  • <bdo id='M0em8'></bdo><ul id='M0em8'></ul>

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