1. 首先导入MBProgressHUD类
2. //自定义提示框
- (void)showAllTextDialog:(NSString *)str
{
MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:self.view];
[[[[UIApplication sharedApplication] delegate] window] addSubview:hud];
hud.labelText = str;
hud.mode = MBProgressHUDModeText;
[hud showAnimated:YES whileExecutingBlock:^{
sleep(1);
} completionBlock:^{
[hud removeFromSuperview];
}];
}
//自定义提示框
+ (void)showAllTextDialog:(NSString *)str
{
MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:[UIApplication sharedApplication].keyWindow];
[[[[UIApplication sharedApplication] delegate] window] addSubview:hud];
hud.labelText = str;
hud.mode = MBProgressHUDModeText;
hud.yOffset = 250.0f;
[hud showAnimated:YES whileExecutingBlock:^{
sleep(1);
} completionBlock:^{
[hud removeFromSuperview];
}];
}