I wan to to show a message using the MBProgressHUD during the uploading via NSURL string. So i code that:
MBProgressHUD *hud1 = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
hud1.labelText = @"sending info ...";
hud1.minShowTime =10.0;
NSURL *url =[NSURL URLWithString:self.urlToUpload];
the 10 second time is in order to wait some time i want user wait. It works, but I would show another message when the first desappear. Using another:
MBProgressHUD *hud2 = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
hud2.labelText = @"SENT!";
hud2.minShowTime =2.0;
it is not useful, because this message overlaps the first one. Any tips about that?
I would remove the first HUD in your -connectionDidFinishLoading
method or wherever you get notification that the string has been uploaded successfully.
[MBProgressHUD hideHUDForView:self.view animated:YES];
Then you can add your next HUD for 1-2 seconds. By just adding it via a specific time, there is no way to accurately remove the first HUD before the next one shows.
This was taken from the MBProgressHUD demo project. I would use this to display your timed completion HUD.
HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view];
[self.navigationController.view addSubview:HUD];
// The sample image is based on the work by http://www.pixelpressicons.com, http://creativecommons.org/licenses/by/2.5/ca/
// Make the customViews 37 by 37 pixels for best results (those are the bounds of the build-in progress indicators)
HUD.customView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"37x-Checkmark.png"]] autorelease];
// Set custom view mode
HUD.mode = MBProgressHUDModeCustomView;
HUD.delegate = self;
HUD.labelText = @"Completed";
[HUD show:YES];
[HUD hide:YES afterDelay:3];