我使用SDWebImage
库从服务器下载远程图像。但是,当我在 EDGE 连接中时,它花费了太多时间,并且在下载NSLog
值后显示但图像没有显示在UIButton
代码:
int Width = 0;
for (int i = 0; i<[productimg_array count]; i++ ) {
NSLog(@"index %@", productimg_array[i]);
imgView1=[[UIButton alloc]initWithFrame:CGRectMake(20+(i*74), 0, 72, 72)];
Width = Width + 20+(i*74);
[imgView1 setTag:i+1];
[imgView1 addTarget:self action:@selector(dbClicked:) forControlEvents:UIControlEventTouchUpInside];
// [imgView1 setImageWithURL:[NSURL URLWithString:[productimg_array objectAtIndex:i]]
// forState:UIControlStateNormal];
[imgView1 setImageWithURL:[NSURL URLWithString:[productimg_array objectAtIndex:i]] forState:UIControlStateNormal completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType) {
NSLog(@"download images 1");
}];
[scrollview addSubview:imgView1];
}
[scrollview setContentSize:CGSizeMake(Width,imgView1.frame.size.height+20)];