我正在使用SDWebImage将图像加载到我的表格单元格中 - 但是,直到我选择了该行,当我看到图像显示为图像时在屏幕上动画。当我从导航控制器上点击后,图像就在那里。使用SDWebImage将图像加载到UITableView单元时出现的问题
这可能只是网络速度问题还是我错过了什么?这是正在只是在一瞬间在模拟器上运行,如果有差别
代码:
- (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;
}
感谢
可能可能已经修复它 - 占位符图像文件名是一个错字,它似乎现在工作。如果可以的话,我会将它标记为已回答。 – Dave