【发布时间】:2016-04-14 06:39:46
【问题描述】:
我正在尝试使用 NSURLSessionTask 上传 2 张图片(一次一张)。
- (void)URLSession:(NSURLSession *)session
task:(NSURLSessionTask *)task
didSendBodyData:(int64_t)bytesSent
totalBytesSent:(int64_t)totalBytesSent
totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend
{
if (self.imageName1 != nil && self.imageName2 != nil)
{
float progress = (float)totalBytesSent / (float)totalBytesExpectedToSend;
if (progress != 1.00)
{
// Calculate total bytes to be uploaded or the split the progress bar in 2 halves
}
}
else if (self.imageName1 != nil && self.imageName2 == nil)
{
float progress = (float)totalBytesSent / (float)totalBytesExpectedToSend;
if (progress != 1.00)
[self.progressBar1 setProgress:progress animated:YES];
}
else if (self.imageName2 != nil && self.imageName1 == nil)
{
float progress = (float)totalBytesSent / (float)totalBytesExpectedToSend;
if (progress != 1.00)
[self.progressBar2 setProgress:progress animated:YES];
}
}
如果上传 2 张图片,如何使用单个进度条显示进度?
【问题讨论】:
标签: objective-c nsurlsessionuploadtask