Reputation: 8948
Basically I have 3 steps:
I was thinking of using MBProgressHUD for each of these actions - I show hud, and use the showWhileExecuting
method. Then when I hide hud in that code I call the next action, and show hud again.
In theory this should work, but is this the way this should be done?
Upvotes: 1
Views: 347
Reputation: 215
i get the frist Action at button clicked,i use this :
HUD = [[MBProgressHUD alloc] initWithWindow:[UIApplication sharedApplication].keyWindow];
[self.view.window addSubview:HUD];
// Regiser for HUD callbacks so we can remove it from the window at the right time
HUD.delegate = self;
// Show the HUD while the provided method executes in a new thread
[HUD showWhileExecuting:@selector(DNS_info) onTarget:self withObject:nil animated:YES];
and then 2 button clicked , get the action ,like this :
HUD = [[MBProgressHUD alloc] initWithWindow:[UIApplication sharedApplication].keyWindow];
[self.view.window addSubview:HUD];
// HUD.dimBackground = NO;
// Regiser for HUD callbacks so we can remove it from the window at the right time
HUD.delegate = self;
// Show the HUD while the provided method executes in a new thread
[HUD showWhileExecuting:@selector(whois) onTarget:self withObject:nil animated:YES];
i think, this is help to you.
Upvotes: 1
Reputation: 679
It would be better to not depend on MBProgressHUD. You should use it as a feedback element for the user, not as an operation manager.
You could use a NSOperationQueue, for example, and just notify the hud to update its data/status in each iteration.
Of course, you could use it like you said, but does not seems clean to me (programatically).
Upvotes: 2