How to use MBProgressHUD with swift

后端 未结 10 1633
北海茫月
北海茫月 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:33

    You can also try this approach which will keep the other activity running in the background allowing the UI to remain responsive, providing users with a better experience. This is the intended/recommended approach for using the MBProgressHUD.

    let progressHUD = MBProgressHUD.showHUDAddedTo(self.view, animated: true)
    progressHUD.labelText = "Loading..."
    
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0)) {
    
        // ...Run some task in the background here...
    
        dispatch_async(dispatch_get_main_queue()) {
            progressHUD.hide(true)
    
            // ...Run something once we're done with the background task...
        }
    }
    

提交回复
热议问题