我想在下载大图像时显示进度。我是 设置图片路径如下。
UIImage *backgroundImage =[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:backgoundImagePath]]];
如何使用 AFNetworking 框架显示图像的下载进度。
最佳答案
试试这个,
[manager setDownloadTaskDidWriteDataBlock:^(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite) {
float percentageDone = ((float)totalBytesWritten/(float)totalBytesExpectedToWrite)*100;
NSLog(@"Downloading..%.f",percentageDone);
}];
关于ios - 使用 AFNetworking 显示下载图像的进度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28829295/