Iphone 将图像异步加载到UITableView iOS 5
在将图像加载到单元格时,我正在努力使tableView平滑滚动。目前我正在做:Iphone 将图像异步加载到UITableView iOS 5,iphone,image,ios5,tableview,download,Iphone,Image,Ios5,Tableview,Download,在将图像加载到单元格时,我正在努力使tableView平滑滚动。目前我正在做: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { if (self.newsFeedArray != nil) { NewsFeedCustomCell *cell = [tableView dequeueReusableCellWithId
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (self.newsFeedArray != nil) {
NewsFeedCustomCell *cell = [tableView dequeueReusableCellWithIdentifier:@"NewsCell"];
self.singleStory = [self.newsFeedArray objectAtIndex:indexPath.row];
NSString *imageURL = [NSString stringWithFormat:@"%@", [self.singleStory valueForKey:@"image_primary"]];
NSURL *imageLink = [NSURL URLWithString:imageURL];
cell.newsFeedImage.image = [UIImage imageWithData: [NSData dataWithContentsOfURL:imageLink]];
cell.newsTitleLabel.text = [NSString stringWithFormat:@"%@", [self.singleStory valueForKey:@"title"]];
return cell;
} else {
NewsFeedCustomCell *cell = [tableView dequeueReusableCellWithIdentifier:@"LoadingCell"];
return cell;
}
}
我尝试在背景线程中加载图像,但它将对象从数组中取出,这意味着它只在第一个图像中加载10次
我曾尝试实现LazyTableImages,但对我真正需要的东西感到困惑和迷茫。
建议/帮助/解决方法将不胜感激 看一看。该框架使用块简化了异步请求。他们甚至还有一个用于UIImageView
的类别,可以从服务器上检索图像。这可能会有帮助。