在一个堆栈中,我显示的是MBProgressHUD,如果通过使用另一个堆栈,当某些计算调用时,我希望MBProgressHUD从视图中删除,但它没有从..check中删除,那么我所做的错误是什么。
名为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中这样做),我希望通过调用LoginViewController..check代码中的方法从视图中删除..check
- (void)didReceiveResponseFromServer:(NSString *)responseData
{
login=[[LoginViewController alloc]init];
[self.login myTask];
}发布于 2013-03-20 11:53:33
设置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];。
发布于 2016-02-22 08:14:11
就像我一样,我键入[MBProgressHUD hideHUDForView:bAnimatedView animated:YES],但当我快速地推入和退出时,它将无法工作。所以我添加了一些东西来检查MBProgressHUD的视图。
MBProgressHUD *HUD = [MBProgressHUD HUDForView:bAnimatedView];
if (HUD!= nil) {
[HUD removeFromSuperview];
HUD=nil;
}https://stackoverflow.com/questions/15522207
复制相似问题