Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 使用UIProgressView进度更新标签_Iphone_Xcode_Asihttprequest_Uiprogressview - Fatal编程技术网

Iphone 使用UIProgressView进度更新标签

Iphone 使用UIProgressView进度更新标签,iphone,xcode,asihttprequest,uiprogressview,Iphone,Xcode,Asihttprequest,Uiprogressview,我在主视图的一个单独类文件中使用ASIHTTPRequest队列从web服务器下载多个文件。我已将UIProgressView设置为下载进度委托,如下所示: UIProgressView *myProgressView = [[UIProgressView alloc] init]; [myQueue setDownloadProgressDelegate:myProgressView]; 然后,我可以使用以下方法成功记录requestFinished方法中的进度: NSLog(@"Progr

我在主视图的一个单独类文件中使用ASIHTTPRequest队列从web服务器下载多个文件。我已将UIProgressView设置为下载进度委托,如下所示:

UIProgressView *myProgressView = [[UIProgressView alloc] init];
[myQueue setDownloadProgressDelegate:myProgressView];
然后,我可以使用以下方法成功记录requestFinished方法中的进度:

NSLog(@"Progress: %f", [myProgressView progress]);
所有工作正常,我能够看到日志中显示的正确数量

我希望能够在主视图上更新我的标签文本,但似乎不知道该怎么做……换句话说,如何将进度实时传递给另一个视图/类以更新标签文本

任何指向正确方向的指针都将不胜感激


谢谢

在委托类中设置一个属性,该属性是指向主类的引用指针(使其成为赋值属性)

在创建ASIHTTPRequestQueue并设置其委托时,还要在委托上设置myMainView属性

在主视图类上添加一个方法,例如

-(void) updateProgress:(double) progress {
    // code to update the label text
}
在委托方法中(即当前记录进度的位置):

-(void) updateProgress:(double) progress {
    // code to update the label text
}
[self.myMainView updateProgress:[progressView progress]];