如何添加進度條來下載大圖或任何文件?這裏是我的代碼:下載圖片時的進度條
NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *docsPath = [paths objectAtIndex:0];
NSString *downloadPath = [[[NSString alloc]initWithFormat:@"http://www.zzz.com/%@.jpg",chartFileName]autorelease];
NSString *savePath = [[[NSString alloc]initWithFormat:@"%@/%@.jpg",docsPath, chartFileName]autorelease];
NSURL *url = [[NSURL alloc]initWithString:downloadPath];
NSData *downloadedChartData = [NSData dataWithContentsOfURL:url];
[url release];
[downloadedChartData writeToFile:savePath atomically:YES];
「[NSData dataWithContentsOfURL:]」中沒有顯式的NSURLConnection調用,你能給出一個指針,指向一個完整的帶有進度的下載實現,它只以URLstring開始? – Bogatyr 2011-02-17 10:11:54
或準備好的解決方案http://www.developers-life.com/progress-bar-download-file-on-iphone.html – SAKrisT 2012-07-06 16:17:21