1

私はTableViewControllerを持っています。カスタムセルを使用しています。セルには 2 つのラベルと imageView があります。

SDWebImage で非同期に画像を読み込みたい。

コードは次のとおりです。

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"NewsCell";
    NewsCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
    if (cell == nil)
    {
        cell = [[NewsCell alloc] initWithStyle:UITableViewCellStyleDefault
                                   reuseIdentifier:CellIdentifier];
    }
    News* new = [_news objectAtIndex:indexPath.row];
    cell.titleLabel.text = new.title;
    cell.contentLabel.text = new.content;
    if(new.images.count > 0){
        [cell.imageView setImageWithURL:[Helper pathForBigImage:new.images[0]]];
    }

    return cell;
}

最初の読み込みで画像が表示されません。リロードしたら見れます。

どこが間違っていますか?

4

0 に答える 0