I'm trying to upload 2 images(one at a time)using NSURLSessionTask.
- (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];
}
}
How can I use a single progress bar to show the progress in case of 2 image uploads ?