0

1 つのスタックでは、ビューから削除し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 呼び出しが表示されるようになりましたが、ビューは以前と同じになります

いくつかの計算の後 、 ..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

私のように、私はtyrです[MBProgressHUD hideHUDForView:bAnimatedView animated:YES] が、すばやく押したり戻したりするとうまくいきません。そこで、MBProgressHUD の表示を確認するものを追加します。

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