开发者

MBProgressHUB mixed View

开发者 https://www.devze.com 2023-04-02 07:09 出处:网络
- (void) didClickDone{ if (isValide ==0) { (...) [newFormDataRequest setDelegate:self]; [newFormDataRequest startAsynchronous];
- (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];
}

I'm trying to change an MBProg开发者_如何学PythonrassHub after a positive answer from AsiHTTPRequest. But the view remains the same. Do you know why ?

Thanks


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];
}
0

精彩评论

暂无评论...
验证码 换一张
取 消