在一个堆栈中,我正在显示MBProgressHUD
,如果通过使用另一个堆栈,当一些名为I MBProgressHUD
的计算从视图中删除但是它没有从hud中删除..检查我做错了什么..
第一个堆栈名为 LoginViewController.m
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
}
-(void)myTask {
// Do something usefull in here instead of sleeping ...
[MBProgressHUD hideHUDForView:self.view animated:YES];
[self.hud hide:YES];
self.hud=nil;
[self.hud removeFromSuperview];
//[self.hud showWhileExecuting:@selector(myTask1) onTarget:self withObject:nil animated:YES];
}
现在ViewController
获取电话,但视图将与之前和
经过一些计算,我希望在ViewController
中我想通过调用HUD
中的方法从视图中删除LoginViewController
..检查代码
- (void)didReceiveResponseFromServer:(NSString *)responseData
{
login=[[LoginViewController alloc]init];
[self.login myTask];
}
答案 0 :(得分:1)
设置MBProgressHUD
- (void) setupHUD
{
//setup progress hud
self.HUD = [[MBProgressHUD alloc] initWithFrame:self.window.bounds];
[self.SpurView addSubview:self.HUD]; // add it as here.
self.HUD.dimBackground = YES;
self.HUD.minSize = CGSizeMake(150.f, 150.f);
self.HUD.delegate = self;
self.HUD.labelText = @"Loading...";
}
然后使用隐藏[self.HUD hide:YES];
,如代码中所述。
答案 1 :(得分:0)
[MBProgressHUD hideHUDForView:bAnimatedView animated:YES]
但是当我快速推进和退出时,它将无法工作。
所以我添加一些东西来检查MBProgressHUD的视图。
MBProgressHUD *HUD = [MBProgressHUD HUDForView:bAnimatedView];
if (HUD!= nil) {
[HUD removeFromSuperview];
HUD=nil;
}