当我从服务器收到xml响应并且我使用httpconnection从服务器获取xml时,我想要隐藏MBProgressHUD,任何人都帮我? thx之前..
答案 0 :(得分:2)
按照以下步骤隐藏ProgressHUD
为hud取一个类级变量
MBProgressHUD *hud;
然后制作两个函数
-(void)showProgress
{
if (!hud)
hud = [[MBProgressHUD alloc] initWithView:self.view];
[self.view addSubview:hud];
//hud.delegate = self;
hud.labelText = @"Loading...";
[hud show:YES];
}
-(void)hideProgress
{
[hud hide:YES];
[hud removeFromSuperview];
[hud release];
hud=nil;
}
启动网络点击时调用showProgress() 并在调用成功或失败的回调时调用hideProgress()。
答案 1 :(得分:0)
您应该在类或从服务器获取数据的委托中保留MBProgressHUD的实例,
接口中的
{
MBProgressHUD *hud;
}
答案 2 :(得分:0)
我认为您使用HUD删除隐藏
试试这个: -
-(void)hudWasHidden // for remove the hud
{
[HUD removeFromSuperview];
}
打电话给Hud
HUD = [[MBProgressHUD alloc] initWithView:self.view];
HUD.graceTime = .1;
HUD.navigationBar = self.navigationController.navigationBar;
HUD.labelFont = [UIFont fontWithName:@"Arial" size:14];
HUD.delegate = self;
[self.view addSubview:HUD];
[HUD showWhileExecuting:@selector(yourFunction name:) onTarget:self withObject:nil animated:YES];
<。>在.h文件中使用此
MBProgressHUD * HUD;