I am using SDWebImage library to load remote images into a table view which uses a custom cell class i have created. I simply use
[cell.imageView setImageWit
I just had to solve this exact problem and didn't want the overhead of the prefetcher. There must be some extra under-the-hood stuff happening with the built-in imageView property that prevents the loading, because a new UIImageView works just fine.
My solution is pretty clean if you don't mind (or are already) using a subclass of UITableViewCell:
Here's a modified version of my own code (undocumented here is setting the frame to match the size & position of the iOS Photo app's album covers):
YourTableCell.h
@interface YourTableCell : UITableViewCell
@property (nonatomic, strong) UIImageView *coverPhoto;
@end
YourTableCell.m
@implementation YourTableCell
@synthesize coverPhoto;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.imageView.image = nil;
self.coverPhoto = [[UIImageView alloc] init];
// Any customization, such as initial image, frame bounds, etc. goes here.
[self.contentView addSubview:self.coverPhoto];
}
return self;
}
//...
@end
YourTableViewController.m
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
YourTableCell *cell = (YourTableCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
//...
[cell.coverPhoto setImageWithURL:coverUrl placeholderImage:nil options:SDWebImageCacheMemoryOnly];
//...
}