先导入第三方
MBProgressHUD
在VC.m里导入头文件
MBProgressHUD.h
VC.M
//显示提示框
-(void)showMBAlertwWithMessage:(NSString *)msg{
MBProgressHUD *hud = [[MBProgressHUD alloc]initWithView:self.view];
//MBProgressHUDModeIndeterminate 菊花
hud.mode = MBProgressHUDModeText;
hud.labelText = msg;
[self.view addSubview:hud];
[hud show:YES];
[hud hide:YES afterDelay:2.0];
}
//需要的弹窗的时候
[self showMBAlertwWithMessage:@"弹出的文字内容"];
//显示等待指示器
MBProgressHUD *hud = [[MBProgressHUD alloc]initWithView:self.view];
hud.removeFromSuperViewOnHide = YES;
[self.view addSubview:hud];
[hud show:YES];
// 隐藏等待指示器
[hud hide:YES];