Created
June 21, 2013 14:34
-
-
Save ostholz/5831587 to your computer and use it in GitHub Desktop.
AFNetwork download Progress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[op setDownloadProgressBlock:^(NSInteger bytesRead, long long totalBytesRead, long long totalBytesExpectedToRead) { | |
if (totalBytesExpectedToRead > 0) { | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
self.progressView.alpha = 1; | |
self.progressView.progress = (float)totalBytesRead / (float)totalBytesExpectedToRead; | |
NSString *label = [NSString stringWithFormat:@"Downloaded %lld of %lld bytes", | |
totalBytesRead, | |
totalBytesExpectedToRead]; | |
self.progressLabel.text = label; | |
}); | |
} | |
}]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment