【发布时间】: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