0

这是我的代码

MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
hud.mode = MBProgressHUDModeIndeterminate;
hud.labelText = @"Loading..";
dispatch_queue_t dispatchQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0);
dispatch_async(dispatchQueue, ^(void)
{
    [self information];
    [hud hide:YES];
});

我知道方法信息会在一段时间后完成。但即使完成后,进度条也不会消失。可能是什么原因?

4

1 回答 1

3

像这样做

MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
hud.mode = MBProgressHUDModeIndeterminate;
hud.labelText = @"Loading..";
dispatch_queue_t dispatchQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0);
dispatch_async(dispatchQueue, ^(void)
{
[self information];
dispatch_sync(dispatch_get_main_queue(), ^{ 
[hud hide:YES];
});
}); 
于 2013-04-04T12:54:03.503 回答