MBProgressHUB 混合视图

发布于 2024-12-02 18:29:12 字数 790 浏览 0 评论 0原文

- (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。但观点仍然是一样的。你知道为什么吗?

谢谢

- (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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

如歌彻婉言 2024-12-09 18:29:12

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

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];
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文