scribblelover27 scribblelover27 - 6 months ago 5x
Swift Question

UIProgressView setProgress

I am attempting to implement a UIProgress view. I run the function setProgress each time the end of an iteration is performed in a for loop. The progress is set like this:

let progress: Float = Float(i + 1) / Float(list.count)

And the progress function looks like this:

progressView.setProgress(progress, animated: true)

Yet, the progress bar is not updated on each loop. Why is this?


you should do it in your main queue with the async method

dispatch_async(dispatch_get_main_queue()) {
    progressView.setProgress(progress, animated: true)