- (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。但是观点仍然是一样的。你知道为什么吗 ?
谢谢
最佳答案
因为sleep(10)
不允许UIThread更新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];
}
关于iphone - MBProgressHUD混合 View ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7308922/