2015-10-18 2 views
0

Я работаю на быстрое приложение, которое загружает изображения в Dropbox клиента вверх процесс рудного работает отлично я просто хочу, чтобы отобразить ход загрузкиSwift раздаточная прогресс бар

спасибо вам помочь

func uplodeimage(filePath : String , fileData : NSData) 
{ 

     let client = Dropbox.authorizedClient ; 

     client?.filesUpload(path: filePath, body: fileData).progress({ (bytesWritten : Int64, totalBytesWritten : Int64, totalBytesExpectedToWrite : Int64) -> Void in 


     let uplodProgress : Float = Float(totalBytesWritten)/Float(totalBytesExpectedToWrite) as Float; 


dispatch_async(dispatch_get_main_queue(), {() -> Void in 

    self.progressbar.progress = uplodProgress 
    self.progressLabil.text = "\(uplodProgress * 100)%" 
    self.loadingIndicator.stopAnimating(); 
    self.loadingIndicator.removeFromSuperview(); 
    self.loginBtn.enabled = true ; 
    self.uplodBtn.enabled = true; 

      }); 




     }); 


} 

не о том, что прогресс загрузки клиента является функцией Dropbox

+0

Каков ваш вопрос? – smarx

+0

Мне нужно обновить индикатор выполнения –

ответ

0

Вы можете попробовать это:

dispatch_async(dispatch_get_main_queue(), {() -> Void in 
    self.progressBar.setProgress(Float(totalBytesWritten)/Float(totalBytesExpected), animated: true) 
}); 
Смежные вопросы