本文介绍了MBProgressHUB混合视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
- (void) didClickDone{
if (isValide ==0) {
(...)
[newFormDataRequest setDelegate:self];
[newFormDataRequest startAsynchronous];
(...)
//show the label
[self showWithLabel];
}
}
# pragma mark - AsiHTTPRequest delegate methods
- (void)requestFinished:(ASIHTTPRequest *)request
{
NSLog(@"PostAdRequest = %@", [request responseString]);
HUD.customView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"37x-Checkmark.png"]] autorelease];
HUD.mode = MBProgressHUDModeCustomView;
HUD.labelText = @"Completed";
sleep(10);
[self hudWasHidden];
[self dismissModalViewControllerAnimated:YES];
}
在我从AsiHTTPRequest获得肯定答复后,我正在尝试更改MBPrograssHub.但是观点仍然是一样的.你知道为什么吗?
I'm trying to change an MBPrograssHub after a positive answer from AsiHTTPRequest. But the view remains the same. Do you know why ?
谢谢
推荐答案
因为sleep(10)
不允许UIThread更新HUD.
Because the sleep(10)
isn't allowing the UIThread to update the HUD.
- (void)requestFinished:(ASIHTTPRequest *)request {
NSLog(@"PostAdRequest = %@", [request responseString]);
HUD.customView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"37x-Checkmark.png"]] autorelease];
HUD.mode = MBProgressHUDModeCustomView;
HUD.labelText = @"Completed";
[self performSelector:@selector(removeHUD) withObject:nil afterDelay:10.0f];
}
- (void) removeHUD {
[self hudWasHidden];
[self dismissModalViewControllerAnimated:YES];
}
这篇关于MBProgressHUB混合视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!