Help me! I want download a file. And how display progress bar?
I read a lot of articles and I do not work, do not work, you can explain to me how to do it?
Help me! I want download a file. And how display progress bar?
I read a lot of articles and I do not work, do not work, you can explain to me how to do it?
You can get expected total file size in following callback method of NSURLconnection,
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
expectedTotalSize = response.expectedContentLength;
}
then in the following callback method you can calculate how much data has been recieved,
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
recievedData += data.length;
}
And you can use UIProgressView to show current downloading status on the screen.