2011-09-17 20 views
0

リモートイメージをダウンロードし、'image'プロパティを使用してUIImageViewオブジェクトにコンテンツを追加するという簡単なコードで問題があります。ダウンロードした画像を表示するのではなく、古い画像を表示します。責任を負うキャッシングはありますか?私は何かをリセットしてキャッシュファイルを削除しましたが、なぜこの古いイメージがまだ表示されているのか理解できません。なぜイメージがUIImageViewに表示されないのですか

- (void)connectionDidFinishLoading:(NSURLConnection *)connection 
{ 
    // Set appIcon and clear temporary data/image 
    UIImage *image = [[UIImage alloc] initWithData:self.activeDownload]; 

    if (image.size.width != kAppIconHeight && image.size.height != kAppIconHeight) 
    { 
     CGSize itemSize = CGSizeMake(kAppIconHeight, kAppIconHeight); 
     UIGraphicsBeginImageContext(itemSize); 
     CGRect imageRect = CGRectMake(0.0, 0.0, itemSize.width, itemSize.height); 
     [image drawInRect:imageRect]; 
     self.image_view.image = UIGraphicsGetImageFromCurrentImageContext(); 
     UIGraphicsEndImageContext(); 
    } 
    else 
    { 
     self.image_view.image = image; 
    } 

    self.activeDownload = nil; 
    [image release]; 

    // Release the connection now that it's finished 
    self.imageConnection = nil; 

    // call our delegate and tell it that our icon is ready for display 
    [delegate appImageDidLoad:self.indexPathInTableView]; 
} 
+1

いくつかのコードを表示できますか? – Stuart

+0

あなたは同じ画像名を使用していますか? –

答えて

1

イメージプロパティを設定した後に[imageView setNeedsDisplay]を呼び出すようにしてください。

+0

それを修正しません! – Steve

関連する問題