Objective c 如何使用SDWebImage声明UIImageView
我刚刚将SDWebImage添加到我的项目中,但我真的不明白如何使用以下方法:Objective c 如何使用SDWebImage声明UIImageView,objective-c,Objective C,我刚刚将SDWebImage添加到我的项目中,但我真的不明白如何使用以下方法: [cell.img setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"] placeholderImage:[UIImage imageNamed:@"placeholder.png"]]; 但我得到了一个错误: No visible @interface for 'UI
[cell.img setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"]
placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
但我得到了一个错误:
No visible @interface for 'UIImageView' declares the selector 'setImageWithURL:placeholderImage:'
我添加了标题:
#import "UIImageView+WebCache.h"
并将img声明为UIImageView,我缺少了什么?因为您可以看到UIImageView WebCache类别的每个方法都有前缀sd,所以您应该使用方法sd_setImageWithURL:Placeholder Image:而不是setImageWithURL:Placeholder Image: