Async Images Download in a UITableView using Story

2019-08-18 14:12发布

问题:

I have a UITableView and I had like to download images asynchronously. How can I do using using ios5 and storyboards?

Thanks in advance

回答1:

I was having the very same problem, and what I did was take SDWebImage from https://github.com/rs/SDWebImage, open up the project on its own, and manually upgrade it to Objective C ARC (Refactor --> Convert to Objective C ARC).

When it was done being converted, I added it the individual files to my project and it works like a charm. I just

#import "UIImageView+WebCache.h"

and then in my - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath method, it loks like this:

[cell.videoImageView setImageWithURL:[NSURL URLWithString:thumbnailURLString]];

Simple!