Reputation: 119
I'm displaying some views,webVies and while they are loading i display an ProgressHud with waiting message. I'm using an instance of that object :
MBProgressHUD * progrssHUD
Using the show
and hide
methods to control over loading windows. In some views i would like to add view only after the hide
method is turned on - meaning no window displayed now.
How can i check from any interface what is that status of MBProgressHUD
and only after status X to do something?
Upvotes: 3
Views: 4668
Reputation: 7102
If you see the implementation of MBProgresshud
then you will find that when they are hiding it they are setting it's alpha
0 and when they are showing it they are setting it alpha 1.
So you can use this property to check whether it is hidden or shown. i.e
if(progrssHUD.alpha == 0){
//perform hide operation
}else{
//Perform show operation
}
Upvotes: 3
Reputation: 6158
-(IBAction)SHOW{
HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view];
[self.navigationController.view addSubview:HUD];
HUD.delegate = self;
[HUD show:YES];
// Show the HUD while the provided method executes in a new thread
[HUD showWhileExecuting:@selector(showHUD) onTarget:self withObject:nil animated:YES];
}
- (void)hudWasHidden:(MBProgressHUD *)hud {
// Remove HUD from screen when the HUD was hidded
[HUD removeFromSuperview];
[HUD release];
HUD = nil;
}
THE METHOD showWhileExecuting CALLING THE HUD WAS ACTIVE WHILE THE DELEGATE METHOD WILL COME.
Upvotes: 0