MBProgressHUB mixed View

萝らか妹 提交于 2020-01-06 08:49:34

问题


- (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 MBPrograssHub after a positive answer from AsiHTTPRequest. But the view remains the same. Do you know why ?

Thanks


回答1:


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


来源:https://stackoverflow.com/questions/7308922/mbprogresshub-mixed-view

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!