I’m using SDWebImage to load images into my table cells – however the images aren’t appearing until I’ve selected the row, when I see the image appear just as the table is being animated off the screen. When I click back from my navigation controller the image is there.
Is this likely to be just a speed issue with the web or am I missing something? This is being run on the simulator only at the moment if that makes a difference
Code:
- (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;
}
Thanks
Fixed, it was the placeholder image not being correct. Sorry for wasting people’s time…