【问题标题】:MBProgressHUD UI not respondingMBProgressHUD UI 没有响应
【发布时间】:2013-04-05 03:57:47
【问题描述】:

我发现我的 UI 在使用 MBProgress HUD 时没有响应,而在设备上调试时它显示消息“wait_fences 未能收到回复”。我认为我以错误的方式使用 MBProgressHUD。有人可以告诉我在以下情况下使用 MBProgressHUD 的最佳方法是什么。

if (!self.detailController) {

            DetailViewController *detailVC = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil];
            detailVC.view.autoresizingMask = baseView.autoresizingMask; //(baseView Alerady added on xib for orientation purpose)
            self.detailController = detailVC;
            [detailVC release];
        }
        [self.view addSubview: self.detailController.view]; //Removing detailController.view before calling to this function.
        [self.detailController makeServiceCall];

        -(void)makeServiceCall
        {
            //HUD is class level variable 
            if (!HUD) {
                HUD = [[MBProgressHUD alloc] initWithView:self.view.window];    
                HUD.dimBackground = YES;
                [self.view.window addSubview:HUD];
                HUD.labelText = @"";
            }
            //Showing the HUD progress bar
            [HUD show:YES];

            //Async call code for service call, once connection end hiding the HUD. 
        }

        -(void)parsingFinished
        {
            //Data handling goes here..
            [HUD hide:YES];
        }

我研究了 UI 无响应,发现 HUD 需要在 viewDidAppear 方法中显示,但我将视图添加为子视图,因此不会调用 viewDidAppear。

如果我从我的应用程序中移除 HUD,它会非常好用,所以我确信应用程序没有响应是因为 HUD 的使用方式错误。 我在我的应用程序的很多地方都这样做了。需要我可以申请的最佳解决方案。

【问题讨论】:

    标签: ios user-interface mbprogresshud


    【解决方案1】:

    MBProgressHUD 会在 UI 可见时阻止与它的交互。如果这是可配置的,但阻止其父视图的 UI 是其默认状态,我忘记了我的头顶。特别是如果您将其添加到窗口而不是子视图。

    【讨论】:

      猜你喜欢
      • 2017-10-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-04
      • 1970-01-01
      • 2018-03-03
      • 2021-05-11
      • 1970-01-01
      相关资源
      最近更新 更多