【发布时间】:2012-08-14 06:21:22
【问题描述】:
我正在尝试将 SdWebImage 与 Youtube Api 集成,以获取缩略图图像以缓存它们,从而摆脱 UITableView 中的滚动问题。问题是 Youtube API 提供一个用于缩略图 NSDATA 的 URL,它可以转换回UIImage 对象,但 SDWebImage 是获取图像的 URL,以最有效的方法管理图像。
Youtube API 方法:
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:[[thumbnails objectAtIndex:0] URLString]]];
UIImage * image = [UIImage imageWithData:data];
SDWebImage 方法
[cell.imageView setImageWithURL:[NSURL URLWithString:[_objects objectAtIndex:indexPath.row]]
placeholderImage:[UIImage imageNamed:@"placeholder"]];
请告诉我们如何解决这个问题。
【问题讨论】:
标签: ios5 youtube-api sdwebimage