I am using the ASIHTTPRequest Queue in a seperate class file from my main view to download multiple files from my web server. I have set an UIProgressView as the download progress delegate as follows:
UIProgressView *myProgressView = [[UIProgressView alloc] init];
[myQueue setDownloadProgressDelegate:myProgressView];
I can then successfully NSLog the progress in the requestFinished method by using:
NSLog(@"Progress: %f", [myProgressView progress]);
All works fine and am able to see the correct amounts displayed in the log.
What I want to be able to do is update my label text on the main view but can't seem to figure out to do this.....another words, how to pass the progress in real time to another view/class for updating the label text.
Any pointers in the right direction would be greatly appreciated!
Thanks!
In your delegate class set a property which is a reference pointer back to the main class (make it an assign property).
MyMainView *myMainView
@property (nonatomic, assign) MyMainView *myMainView
At the time you create the ASIHTTPRequestQueue and set its delegate, also set the myMainView property on the delegate.
On your main view class add a method, e.g.
-(void) updateProgress:(double) progress {
// code to update the label text
}
In your delegate method (i.e. where you currently log the progress):
[self.myMainView updateProgress:[progressView progress]];