I have setup multiple downloads within my app, what is the best way to go about setting up multiple progressView's.
Sample code below, but there is only one progressView.
Code:
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
[responseData setLength:0];
filesize = [[NSNumber numberWithLong: [response expectedContentLength] ] retain];
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
[self updateDownloaded];
[filesize release];
[connection release];
}
-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
[responseData appendData:data];
NSNumber* curLength = [NSNumber numberWithLong:[responseData length] ];
float progress = [curLength floatValue] / [filesize floatValue];
progressView.progress = progress;
}
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
NSLog(@"Download failed");
[connection release];
}
If a user presses the first button the first progress begins as the file downloads. But when the second button is pressed, I would like the first to continue running as it is, but also add a second one by the second button and begin loading that as it downloads. Hopefully this is clear. Any help at all is appreciated.