1

アプリでカスタムUITableViewセルを使用しており、LazyTableImagesサンプルコードを統合してテーブルビューに画像をダウンロードしました。私は以下のコードを使用しています

- (void)appImageDidLoad:(NSIndexPath *)indexPath
    {
        IconDownloader *iconDownloader = [imageDownloadsInProgress objectForKey:indexPath];
        if (iconDownloader != nil)
        {
            CustomTblViewCell *cell = (CustomTblViewCell *)[self.TblView cellForRowAtIndexPath:iconDownloader.indexPathInTableView];

            // Display the newly loaded image
            cell.ImgViewUser.image = iconDownloader.appRecord.m_strImage;
        }

        // Remove the IconDownloader from the in progress list.
        // This will result in it being deallocated.
        [imageDownloadsInProgress removeObjectForKey:indexPath];
        [m_CtrlTblViewFacetoface reloadData ];
}

上記のコードはデータをロードしていませんがUITableView、Customcellの代わりにセルを使用した場合、それは機能しています、何か考えはありますか?

4

1 に答える 1

0

以前に使用したライブラリがあり、「 SDWebImage 」と呼ばれるこのライブラリがうまく機能しました。メソッドで簡単に使用できます。

[cell.ImgViewUser setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"]
               placeholderImage:[UIImage imageNamed:@"placeholder.png"]];

画像を自動的にキャッシュし、キャッシュからの読み込みのみをサポートし (必要な場合)、メモリ警告を自動的に処理します。

于 2012-11-26T07:16:26.447 に答える