Progress bar while downloading files iOS

瘦欲@ 提交于 2019-11-29 10:49:57

I would recommend looking into the ASIHTTP library, which contains a lot of usefull classes on mobile handling and download handling.

Here is a link where they describe what ASIHTTP can offer in terms of download progress tracking : http://allseeing-i.com/ASIHTTPRequest/How-to-use#progress

add

expectedBytes = [response expectedContentLength];

to

-(void)connection:(NSURLConnection*)connection didReceiveResponse:(NSURLResponse*)response

and add

float progress = ((_bytesReceived/(float)_expectedBytes)*100)/100;

to

-(void)connection:(NSURLConnection*)connection didReceiveData:(NSData*)data

then setProgress: on your UIProgressView

From: http://www.developers-life.com/progress-bar-download-file-on-iphone.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!