使用SDWebImage将图像加载到UITableView单元格时出现问题

时间:2011-09-21 13:24:09

标签: ios4 uitableview

我正在使用SDWebImage将图像加载到我的表格单元格中 - 但是在我选择行之前图像不会出现,当我看到图像出现时,就像桌面在屏幕上动画一样。当我从导航控制器单击后退时,图像就在那里。

这可能只是网络的速度问题,还是我错过了什么?如果这会产生影响,那么目前只能在模拟器上运行

代码:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = @"SimpleTableIdentifier";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if(cell == nil)
{
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier] autorelease];
}

// Configure the cell...

NSUInteger row = [indexPath row];

// Here we use the new provided setImageWithURL: method to load the web image
[cell.imageView setImageWithURL:[NSURL URLWithString:@"http://mydomain.com/uploads/news1.png"] placeholderImage:[UIImage imageNamed:@"placeholder.png"]];

cell.textLabel.text = [listData objectAtIndex:row];

return cell;

}

由于

1 个答案:

答案 0 :(得分:3)

修正了,占位符图片不正确。很抱歉浪费了人们的时间......