Reputation: 33
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) {
NSLog(@"%d",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?
Upvotes: 0
Views: 88
Reputation: 130102
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];
Upvotes: 3