Prgmmr Prgmmr - 1 year ago 82
iOS Question

UIProgressView gets to value 100 before the actual float being 100

When using progressView inside a UITableViewCell, i use as so

cell.imageView.file = (PFFile *)object[@"image"];
[cell.imageView loadInBackground:^(UIImage * _Nullable image, NSError * _Nullable error) {

} progressBlock:^(int percentDone) {
dispatch_async(dispatch_get_main_queue(), ^{
[cell.progressBar setProgress:percentDone animated:YES];
if (percentDone == 100) {
[cell.progressBar setHidden:YES];


Im NSLogging the percentDone, and the progressView gets to 100 before the percentDone gets to 100. This is on the second cell so maybe something to do with reuse?

Answer Source

The progress in UIProgressView is represented as a value between 0.00 and 1.00. If your values are integers 0 through 100, you want to multiply them by 0.01.

[cell.progressBar setProgress:percentDone * 0.01 animated:YES];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download