MBProgressHUD视图不隐藏



在一个堆栈中,我显示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];
 }

现在ViewController得到调用,但视图将是相同的Previous和

经过一些计算,我想在ViewController中,我想通过调用LoginViewController中的方法从视图中删除HUD ..校验码

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

设置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];在你的代码中描述

我是[MBProgressHUD hideHUDForView:bAnimatedView animated:YES]但有时当我快速地推进推出时,它就不起作用了。所以我添加了一些东西来检查MBProgressHUD的视图。

 MBProgressHUD *HUD = [MBProgressHUD HUDForView:bAnimatedView];
 if (HUD!= nil) {
     [HUD removeFromSuperview];
     HUD=nil;
 }

最新更新