我尝试显示此代码,MBProgressHUD
但是当我单击另一个选项卡并返回此选项卡时,MBProgressHUD
无法隐藏。我尝试了 2 个功能:
为了updatearray()
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 updatearray];
dispatch_sync(dispatch_get_main_queue(), ^{
[hud hide:YES];
});
});
对于 getVideolist()
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 getVideolist];
dispatch_sync(dispatch_get_main_queue(), ^{
[hud hide:YES];
});
});
第一次,它运行正常。但是单击另一个选项卡并返回后,它无法隐藏。