In your function didReceiveResponse you can get the total size of the file as follows:
_totalFileSize = response.expectedContentLength;.
In your didReceiveData function, you can add a total counter of received bytes:
_receivedDataBytes += [data length];
Now, to set the progress bar to the correct size, you can simply do:
MyProgressBar.progress = _receivedDataBytes / (float)_totalFileSize
( didReceiveData, - )
, !
, .
EDIT: progressview
-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
_totalFileSize = response.expectedContentLength;
responseData = [[NSMutableData alloc] init];
}
-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
_receivedDataBytes += [data length];
MyProgressBar.progress = _receivedDataBytes / (float)_totalFileSize;
[responseData appendData:data];
}