0

在一个堆栈中,当我想从视图中删除一些计算时,我正在显示MBProgressHUD如果使用另一个堆栈,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];
 }

现在ViewControllerget 调用,但视图将是相同的 Previous 和

经过一些计算,我希望 通过调用..check 代码中的方法从视图ViewController中删除HUDLoginViewController

 - (void)didReceiveResponseFromServer:(NSString *)responseData
 {
     login=[[LoginViewController alloc]init];

     [self.login myTask];
 }
4

2 回答 2

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]; 然后按照代码中的描述使用隐藏。

于 2013-03-20T11:53:33.357 回答
0

像我一样,我很累[MBProgressHUD hideHUDForView:bAnimatedView animated:YES] ,但是当我快速推入和退出时,它有时会不起作用。所以我添加了一些东西来检查 MBProgressHUD 的视图。

 MBProgressHUD *HUD = [MBProgressHUD HUDForView:bAnimatedView];
 if (HUD!= nil) {
     [HUD removeFromSuperview];
     HUD=nil;
 }
于 2016-02-22T08:14:11.193 回答