dox*_*xsi 2 iphone mbprogresshud
我想在通过NSURL字符串上传期间使用MBProgressHUD显示消息.所以我编码:
MBProgressHUD *hud1 = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
hud1.labelText = @"sending info ...";
hud1.minShowTime =10.0;
NSURL *url =[NSURL URLWithString:self.urlToUpload];
Run Code Online (Sandbox Code Playgroud)
10秒的时间是为了等待一段时间我希望用户等待.它有效,但是当第一个消失时我会显示另一条消息.使用另一个:
MBProgressHUD *hud2 = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
hud2.labelText = @"SENT!";
hud2.minShowTime =2.0;
Run Code Online (Sandbox Code Playgroud)
它没用,因为这条消息与第一条消息重叠.有关于此的任何提示?
我会删除您-connectionDidFinishLoading方法中的第一个HUD,或者在您收到成功上传字符串的通知的任何地方.
[MBProgressHUD hideHUDForView:self.view animated:YES];
Run Code Online (Sandbox Code Playgroud)
然后你可以添加你的下一个HUD 1-2秒.只需在特定时间添加它,就无法在下一个HUD显示之前准确删除第一个HUD.
这取自MBProgressHUD演示项目.我会用它来显示你的定时完成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];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2342 次 |
| 最近记录: |