gpt4 book ai didi

ios - MBProgressHUD 不显示

转载 作者:行者123 更新时间:2023-12-01 18:14:04 29 4
gpt4 key购买 nike

在我移动到下一个 View Controller 之前,我想显示 MBProcessHUD 5 秒钟。这是当前的实现

-(void)login
{
MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:self.view];
[hud setDimBackground:YES];
[hud setOpacity:0.5f];
[hud show:YES];
[hud hide:YES afterDelay:10.0];

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UITabBarController *obj=[storyboard instantiateViewControllerWithIdentifier:@"accountTableViewController"];
[self.navigationController pushViewController:obj animated:YES];
}

不幸的是,HUD 根本不显示。

最佳答案

尝试:

-(void)login
{
MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:self.view];
[hud setDimBackground:YES];
[hud setOpacity:0.5f];
[hud show:YES];
[hud hide:YES afterDelay:5.0];

[self performSelector:@selector(pushView) withObject:nil afterDelay:5.0];
}

- (void) pushView {

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UITabBarController *obj=[storyboard instantiateViewControllerWithIdentifier:@"accountTableViewController"];
[self.navigationController pushViewController:obj animated:YES];

}

尽管这应该可行,但我假设您将进行一些处理以尝试登录用户?在这种情况下,您可以使用:
    [hud showAnimated:YES whileExecutingBlock:^{
//Log the user in:
} completionBlock:^{
//Then push the new view here, the hud will automatically dismiss.
}];

关于ios - MBProgressHUD 不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24570343/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com