2012-04-17 72 views
0

加入SDWebImage lib和把自己的標準代碼後:的UIImageView誤差SDWebImage

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

我得到了一個錯誤:

ViewController.m: error: Automatic Reference Counting Issue: Receiver type 'UIImageView' for instance message does not declare a method with selector 'setImageWithURL:placeholderImage:'

我怎樣才能解決呢?

回答

2

由於documentations表示,您應該導入"UIImageView+WebCache.h",這是在UIImageView類別中聲明方法setImageWithURL:placeholderImage:的標頭。

#import "UIImageView+WebCache.h" 

// ... 

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

哦,該死的,我以爲我已經加了它......非常感謝! – Nathaniel 2012-04-17 19:02:03