下载状态和进度条不显示

时间:2013-10-14 06:35:36

标签: uitableview asihttprequest downloading download-manager

我在一个单元格中使用ASIHTTP库下载多个文件,并显示多个进度和状态,如接收的字节等。它工作正常但很多用户指向该服务器之后发生状态和进度条没有显示和一些延迟启动发生在ASIHTTPRequest的响应块中。请帮助我

提前致谢

1 个答案:

答案 0 :(得分:0)

您只需导入所有ASIHTTPRequest库,并且在使用进度条时需要使用协议文件导入,并在下面使用内置方法...

- (void)viewDidLoad
{
    [super viewDidLoad];
    NSString *url=@"http://dulemba.com/Visits/Cover-GGCC(2mb).jpg";

    proTo = [[protocol_file alloc]initWithURL:[NSURL URLWithString:url] delegate:self];




    imageView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 10, 300, 250)];
    [self.view addSubview:imageView];
    lbl=[[UILabel alloc]initWithFrame:CGRectMake(0, 250, 200, 100)];
    [self.view addSubview:lbl];
    lblPers=[[UILabel alloc]initWithFrame:CGRectMake(100, 250, 200, 100)];
    [self.view addSubview:lblPers];
    progressBar = [[UIProgressView alloc] initWithFrame:CGRectMake(0, 280, 300, 90)];
    [self.view addSubview:progressBar];



  }

-(void)imgDownload:(UIImage *)data{
     imageView.image=data;
   NSLog(@"image");}
-(void)setLblvalue:(float)val{
     lblPers.text=[[NSString alloc]initWithFormat:@"%0.2f %%",val];
     }
-(void)setProgValu:(float)val{
 progressBar.progress=val;

// NSLog(@“progress%f”,val); }

-(void)setPersent:(float)val{
     lbl.text = [[NSString alloc] initWithFormat:@"%0.2f MB",val];
}