Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 将图像异步加载到UITableView iOS 5_Iphone_Image_Ios5_Tableview_Download - Fatal编程技术网

Iphone 将图像异步加载到UITableView iOS 5

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

在将图像加载到单元格时,我正在努力使tableView平滑滚动。目前我正在做:

- (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
的类别,可以从服务器上检索图像。这可能会有帮助。