Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 如何使用SDWebImage声明UIImageView_Objective C - Fatal编程技术网

Objective c 如何使用SDWebImage声明UIImageView

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

我刚刚将SDWebImage添加到我的项目中,但我真的不明白如何使用以下方法:

[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: