studentcoder
studentcoder

Reputation: 21

How do you use MBProgressHUD CustomView/Determinate Loader in Swift?

I am trying to run MBProgressHUD in Swift. I have found I am able to run a spinner that is very similar UIAlert spinner, but that I am having trouble with the other functions. According the MBProgress docs, you can also user a determinate loader as well as other functions including a CustomView which could be loaded as a success. I am trying to figure out how to load and access these other functions in Swift.

This is the current code for the indeterminate spinner (the only function I can get working):

let loadingNotification = MBProgressHUD.showHUDAddedTo(self.view, animated: true)
loadingNotification.mode = MBProgressHUDMode.Indeterminate
loadingNotification.labelText = "Loading"

To dismiss the ProgressHUD:

MBProgressHUD.hideAllHUDsForView(self.view, animated: true)

Please excuse such a simple question. I am brand new to programming. Thank you so much for all of your help!

Upvotes: 2

Views: 869

Answers (1)

Dani G.
Dani G.

Reputation: 577

I think that one month later, you have solve it, but if not, I think this will work for you:

loadingNotification.hide(true)

Or with a delay:

loadingNotification.hide(true, afterDelay: 3)

Hope it helps! :)

Upvotes: 1

Related Questions