1、旋转提示类型:旋转的mbp,比如登录中.....
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:YES];
hud.removeFromSuperViewOnHide =YES;
hud.labelText = msg;
hud.minSize =CGSizeMake(80.f,10.0f);
[hudhide:YESafterDelay:1];
2、提示类型:提示,类似于alert的mbp
MBProgressHUD* HUD1 = [[MBProgressHUDalloc] initWithView:view];
[viewaddSubview:HUD1];
HUD1.labelText = msg;
HUD1.mode =MBProgressHUDModeText;
[HUD1showAnimated:YESwhileExecutingBlock:^{
sleep(2);
}completionBlock:^{
[HUD1removeFromSuperview];
}];
[MBProgressHUD showHUDAddedTo:view animated:YES];是直接addsubview到view上面去了,并且,如果是MBProgressHUDModeCustomView自定义模式的话,得使用showHUDAddedTo,形如:
MBProgressHUD* progress_hud1 = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
progress_hud1.mode = MBProgressHUDModeCustomView;
progress_hud1.labelText = NSLocalizedString(@"操作失败", nil);
progress_hud1.customView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"mark_no"]];
[progress_hud1 showAnimated:YES whileExecutingBlock:^{
sleep(2);
} completionBlock:^{
[progress_hud1 removeFromSuperview];
}];
MBProgressHUD* HUD1 = [[MBProgressHUDalloc] initWithView:view];方式生成的mbp,还需要
[view addSubview:HUD1];到view上面去,并且无法实现MBProgressHUDModeCustomView自定义模式,因为