SVProgressHud在几秒钟后消失

时间:2013-08-27 05:51:25

标签: iphone ios svprogresshud

我在我的应用程序中添加了SVProgressHud,并且在大多数viewController中都非常棒。但它在导航控制器的第一个孩子中表现奇怪,当我出现SVProgressHud它会显示但几秒钟后它会消失,只显示活动指示器。
查看此图片,当我显示progressHud时显示

enter image description here

这将在几秒钟后显示

enter image description here

我在viewDidLoad方法中提出了这个进展hud,这里是我的代码。

- (void)viewDidLoad
{
    [super viewDidLoad];

    [SVProgressHUD show];
    [SVProgressHUD showWithStatus:nil maskType:SVProgressHUDMaskTypeBlack];
    [self performSelector:@selector(CallLanSelectDataWS) withObject:@"" afterDelay:0.1];
}

并在处理完成后解雇SVProgressHud。

3 个答案:

答案 0 :(得分:2)

在后台线程中执行任务?

[SVProgressHUD show];

//Execute your task in differentthread
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

    [self callLanSelectDataWS];

    // After this task is done switch back to main thread
    dispatch_async(dispatch_get_main_queue(), ^{

        [SVProgressHUD showSuccessWithStatus:@"YEAH!"];
    });
});

答案 1 :(得分:0)

您可以使用ProgressHUD库,而不是SVPRogressHUD:

    ProgressHUD.show("put here text you want to be below activity indicator", interaction: true) 

    ProgressHUD.show("", interaction: true) 

如果您不想在下面输入任何文字,请放空。

当您要关闭它时,只需输入:

    ProgressHUD.dismiss()

答案 2 :(得分:0)

当前正在寻找相同情况的答案。

默认情况下,SVProgress将在5.0秒后自动关闭, 就我而言,我正在使用hack禁用解雇

在Swift中:

SVProgressHUD.setMinimumDismissTimeInterval(.infinity * 5.0)

可能会根据需要设置指定的最小/最大时间间隔,强制解除可能会有所帮助