Thursday, 15 January 2015

ios - Progress view is not updating - Swift -


I'm working on progress view in Swift

this is my code Task = request.download (urlm !, parameter: zero, progress: in println {(full: double) ("full percent: \ (float)

  var request = HTTPTask (Full)) ") Self.progress.set progress (float (full), animated: true)  

even if complete gives this output

  Full percentage: 0.00880848 percent complete: 0.0132512 percent completed: 0.0175405 percent complete: 0.022103 6 full percentage: 0.0264841 percent complete: 0.0308647 percent complete: 0.0350627 percent complete: 0.0392608 percent complete: 0.0434588 percent complete: 0.0513073 percent complete: 0.0555054 percent complete: 0.05 9 8 9 percent full percentage: 0.0642665 percent complete: 0.0688296 percent complete: 0.0731189 percent Completed: 0.0774994 Percent Completed: 0.081 7887 Percent Completed: 0.09 9 3 Percent Completed: 0.090478 Percent Completed: 0.099676 Percent Completed: 0.104057 Percent Completed: 0.109624 Percent Completed: 0.114278 Percent Completed: 0.11902 4 percent complete: 0.123404 percent complete: 0.127602 percent complete: 0.131983 percent complete: 0.136181 percent complete: 0.136408 percent complete: 0.144759 percent complete: 0.148957 percent complete: 0.153155 percent complete: 0.157901 percent complete: 0.162282 percent complete: 0.166662 percent complete: 0.171043 Percent completed: 0.175241 Completed Percent: 0.175468 Percent Completed: 0.179621 Completed Percentage: 0.184002 Percent Completed: 0.188291 Percent Completed: 0.192672 Percent Completed: 0.197052 Percent Completed: 0.201524 Percent Flood Total: 0.205905 percent complete: 0.210285 percent complete: 0.21494 percent complete: 0.215258 ... full percent: 1.0  

This progress does not update the view here

  Progress.setProgress itself (float (full), animated: true)  

For updated Swift 3

The change in UI should always be on the main / foreground thread, in this case it is happening on the background queue Use:

  disks Ac Queue.main.async {self.Progress.set progress (float (complete), animated: true)}  

foreground to carry it.

Old answer for pre-swift 3

The change in UI should always be on the main / foreground thread, in this situation it is a background Use queue:

  Preshk_asink (Preshn_sndesh_kyu ()) {SelfkProgressksetProgress (float (complete), animated: true)}  

it Foreground to move


No comments:

Post a Comment