//初始化进度框,置于当前的View当中
HUD = [[MBProgressHUD alloc] initWithView:self.view];
[self.view addSubview:HUD];
//如果设置此属性则当前的view置于后台
HUD.dimBackground = YES;
//设置对话框文字
HUD.labelText = @"数据同步...";
//显示对话框
[HUD showAnimated:YES whileExecutingBlock:^{
[self syncAllTable];
//对话框显示时需要执行的操作
// sleep(3);
} completionBlock:^{
//操作执行完后取消对话框
[HUD removeFromSuperview];
HUD = nil;
[self alertView:@"数据已同步"];
}];