0

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.

Dilip Manek
  • 9,095
  • 5
  • 44
  • 56

4 Answers4

2

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!"];
    });
});
Marc
  • 6,051
  • 5
  • 26
  • 56
  • This will display success HUD But i want to display that activity indicator – Dilip Manek Aug 27 '13 at 07:15
  • This will display the activity indicator and after your webservice is finished it will display a success HUD (for about a second). Of course you can replace that line with `[SVProgressHUD dismiss]` – Marc Aug 27 '13 at 07:24
  • No not working that way. it will remove HUD before service give back response. – Dilip Manek Aug 27 '13 at 07:38
  • Then place the '[SVProgressHUD dismiss]` wherever your services returns the response. But make sure to switch to main thread. – Marc Aug 27 '13 at 07:39
  • Nop same thing, right image also display like the second image in my question. – Dilip Manek Aug 27 '13 at 09:18
1

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

ytp92
  • 992
  • 1
  • 9
  • 8
0

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

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

SVProgressHUD.setMinimumDismissTimeInterval(20.0) // 20 seconds
Elmar
  • 2,235
  • 24
  • 22