Skip to content

Commit

Permalink
calling on mainthread to update progress
Browse files Browse the repository at this point in the history
  • Loading branch information
georgel committed Aug 3, 2014
1 parent 03e2010 commit fe12ca2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion UIImageView+ProgressView.m
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ - (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder

[self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:^(NSInteger receivedSize, NSInteger expectedSize) {
CGFloat progress = ((CGFloat)receivedSize / (CGFloat)expectedSize);
[weakSelf updateProgress:progress];
dispatch_async(dispatch_get_main_queue(), ^{
[weakSelf updateProgress:progress];
});

if (progressBlock) {
progressBlock(receivedSize, expectedSize);
}
Expand Down

0 comments on commit fe12ca2

Please sign in to comment.