How to use MBProgressHUD with swift

后端 未结 10 1725
北海茫月
北海茫月 2020-12-08 02:23

here is my code , but it showing the progress . is there any error in this code? please give some idea to fix this, or give some link related to this.

class          


        
10条回答
  •  轮回少年
    2020-12-08 02:54

    I solved it like this:

    import UIKit
    
    class Loader: NSObject {
    
        class func show(message:String = "Processing...", delegate: UIViewController) {
            var load : MBProgressHUD = MBProgressHUD()
            load = MBProgressHUD.showHUDAddedTo(delegate.view, animated: true)
            load.mode = MBProgressHUDMode.Indeterminate
    
            if message.length > 0 {
                load.labelText = message;
            }
    
            UIApplication.sharedApplication().networkActivityIndicatorVisible = true
    
        }
    
    class func hide(delegate:UIViewController) {
        MBProgressHUD.hideHUDForView(delegate.view, animated: true)
            UIApplication.sharedApplication().networkActivityIndicatorVisible = false
        }
    }
    

提交回复
热议问题