-1

I have a webview to load on launch and have a SVProgressHUD to display while loading. This issue is when the load time takes long and the user backs off the view, I want to hide/dismiss the SVProgressHUD.

There is a built in function of dismiss. I tried to put the command in viewDidUnload but it does not work. Any help?

BenMorel
  • 34,448
  • 50
  • 182
  • 322
socbrian
  • 151
  • 1
  • 2
  • 8

3 Answers3

3

From SVProgressHUD project doc, to dismiss your HUD you need to call one of the following method:

+ (void)dismiss;
+ (void)dismissWithSuccess:(NSString*)successString;
+ (void)dismissWithSuccess:(NSString*)successString afterDelay:(NSTimeInterval)seconds;
+ (void)dismissWithError:(NSString*)errorString;
+ (void)dismissWithError:(NSString*)errorString afterDelay:(NSTimeInterval)seconds;

Dismiss it in viewWillDisappear method of your UIViewController, if it has not be dismissed earlier. viewDidUnload is called on specific memory condition (e.g low memory), instead viewWillDisappear is called whenever your view's controller disappears from screen.

Hope it helps.

Lorenzo B
  • 33,216
  • 24
  • 116
  • 190
  • can you check this please http://stackoverflow.com/questions/30642980/ios-svprogresshud-doesnt-dismiss-when-user-moves-from-one-screen-to-another-in – Nischal Hada Jun 04 '15 at 11:51
0

Updated for swift 3:

If you want to dismiss SVProgressHUD after a specific time interval, then used below lines of code:

SVProgressHUD.dismiss(withDelay: 25) // you can change the time interval as you want

//Enjoy..! 

Kiran Jadhav
  • 3,209
  • 26
  • 29
0

Objective C put the following code:

Show Spinner:

[SVProgressHUD show];

Hide Spinner:

[SVProgressHUD dismiss];

and for Swift 4 use the following code:

Show spinner:

SVProgressHUD.show()

Hide spinner:

SVProgressHUD.dismiss()

Is very simple, here is the full documentation: SVProgressHUD Documentation

Regards!

Radames E. Hernandez
  • 4,235
  • 27
  • 37