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

  1. <legend id='wzKrH'><style id='wzKrH'><dir id='wzKrH'><q id='wzKrH'></q></dir></style></legend>
    • <bdo id='wzKrH'></bdo><ul id='wzKrH'></ul>

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

      MBProgressHUD 未显示

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

        <small id='2osi0'></small><noframes id='2osi0'>

          • <legend id='2osi0'><style id='2osi0'><dir id='2osi0'><q id='2osi0'></q></dir></style></legend>

              <tbody id='2osi0'></tbody>
              <bdo id='2osi0'></bdo><ul id='2osi0'></ul>
                <tfoot id='2osi0'></tfoot>
                本文介绍了MBProgressHUD 未显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                在我的应用程序中,我正在加载一个资源繁重的视图,加载大约需要 1 到 2 秒.所以我将它加载到一个单独的线程中,如下所示:

                In my app, I am loading a resource heavy view that takes about 1 to 2 seconds to load. So I am loading it in a separate thread like this:

                hud = [[MBProgressHUD alloc] init];
                [hud showWhileExecuting:@selector(loadWorkbench:) onTarget:self withObject:nil animated:YES];
                

                但它从未出现,并且应用程序在最终用户看来是冻结的.有什么想法我哪里出错了吗?

                however it never appears, and application looks frozen to the end user. any ideas where I have gone wrong?

                推荐答案

                是的.它不会出现,因为您从未告诉将 HUD 添加为窗口的子视图.尝试类似:

                Yes. It does not appear because you never tell add the HUD as a subview of the window. try something like:

                    // Should be initialized with the windows frame so the HUD disables all user input by covering the entire screen
                    HUD = [[MBProgressHUD alloc] initWithWindow:[UIApplication sharedApplication].keyWindow];
                
                    // Add HUD to screen
                    [self.view.window addSubview:HUD];
                
                    // Register for HUD callbacks so we can remove it from the window at the right time
                    HUD.delegate = self;
                
                    HUD.labelText = NSLocalizedString(@"Loading Workbench", nil);
                    HUD.detailsLabelText = NSLocalizedString(@"please wait", nil);
                
                    // Show the HUD while the provided method executes in a new thread
                    [HUD showWhileExecuting:@selector(loadWorkbench:) onTarget:self withObject:nil animated:YES];
                

                由于您将自己设置为 HUD 委托,因此还要添加以下委托方法:

                Since you are setting yourself as the HUD delegate, also add the following delegate method:

                - (void)hudWasHidden {
                    // Remove HUD from screen 
                    [HUD removeFromSuperview];
                
                    // add here the code you may need
                
                }
                

                记得在相应的头文件中添加MBProgressHUDDelegate.

                and remember to add MBProgressHUDDelegate in the corresponding header file.

                这篇关于MBProgressHUD 未显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:MPMoviePlayerController 添加 UIButton 以查看淡入淡出的控件 下一篇:垂直标签栏?

                相关文章

                <tfoot id='ZV6qe'></tfoot>

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

                1. <legend id='ZV6qe'><style id='ZV6qe'><dir id='ZV6qe'><q id='ZV6qe'></q></dir></style></legend>

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