SVProgressHud disappear after few seconds

3.9k Views Asked by At

I have added SVProgressHud in my app and work really greats in most of all viewController. But its behave strangely in first child of navigation controller when i present the SVProgressHud it will displayed but after few seconds it will disappear and just activity indicator only displayed.
See this images, Displayed when i show the progressHud

enter image description here

This will displayed after few seconds

enter image description here

I am presenting this progress hud in viewDidLoad method here is my code.

- (void)viewDidLoad
{
    [super viewDidLoad];

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

and dismissing the SVProgressHud after process completed.

4

There are 4 best solutions below

5
On

Perform the task in a background thread?

[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!"];
    });
});
0
On

currently looking for the answer with the same case.

By default SVProgress will dismiss automatically after 5.0s, In my case, I'm using hack to disable dismiss

in Swift:

SVProgressHUD.setMinimumDismissTimeInterval(.infinity * 5.0)

Maybe set the specified minimum / maximum time interval as your necessary, and force dismiss may help

0
On

By default duration is 5 seconds. You can set/change duration for SVProgressHUD like below:

SVProgressHUD.setMinimumDismissTimeInterval(20.0) // 20 seconds
0
On

You can use ProgressHUD Library, not SVPRogressHUD:

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

or

    ProgressHUD.show("", interaction: true) 

put empty if you don't want any text below.

And when you want to dismiss it just type in:

    ProgressHUD.dismiss()