'UIImageView'没有可见的@interface声明选择器'setImageWithURL'

Loc*_*_Dr 4 xcode objective-c ios sdwebimage xcode6

下午好,

我正在尝试在我的TableViewController中使用SDWebImage,我得到一个错误两个错误(每个图像元素一个),但我可以运行应用程序,我可以看到SDWebImage工作正常,但有这两个错误.

怎么可能?我很高兴SDWebImage工作,但我不知道它显示了那些错误然后它正在工作.

另外我想说当我使用" setImageWithURL "时正在使用那两个错误(但是这个函数没有链接)但是当我使用" sd_setImageWithURL "时不起作用而且我也有这两个错误(但sd_setImageWithURL链接到SDWebImage文件).

那么,我必须使用哪一个?因为我希望这能使它工作,但我想让它工作正常,没有任何错误.

我收到以下错误:

'UIImageView'没有可见的@interface声明选择器'setImageWithURL:placeholderImage:options:'

在下面找到一些代码:

CarTableViewController.m

#import "CarTableViewController.h"
#import "CarTableViewCell.h"
#import "CarTableViewController.h"
#import "CarDetailViewController.h"
#import <SDWebImage/UIImageView+WebCache.h>

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

{

    static NSString *CellIdentifier = @"carTableCell";



    CarTableViewCell *cell = [tableView

                              dequeueReusableCellWithIdentifier:CellIdentifier];



    if (cell == nil) {

        cell = [[CarTableViewCell alloc]

                initWithStyle:UITableViewCellStyleDefault

                reuseIdentifier:CellIdentifier];

    }



    // Configure the cell...

    cell.makeLabel.text = [[_jsonArray objectAtIndex:indexPath.row] valueForKey:@"id"];

    cell.likes.text = [[_jsonArray objectAtIndex:indexPath.row] valueForKey:@"likes"];

    cell.comments.text = [[_jsonArray objectAtIndex:indexPath.row] valueForKey:@"comments"];

    cell.username.text = [[_jsonArray objectAtIndex:indexPath.row] valueForKey:@"username"];

    cell.refuser.text = [[_jsonArray objectAtIndex:indexPath.row] valueForKey:@"user_ref"];



    cell.modelLabel.text = [[_jsonArray objectAtIndex:indexPath.row] valueForKey:@"user"];



    NSURL * imageURL = [NSURL URLWithString:[[_jsonArray objectAtIndex:indexPath.row] valueForKey:@"imagen"]];

    [cell.carImage setImageWithURL:imageURL

                  placeholderImage:[UIImage imageNamed:@"placeholder.png"]

                           options:SDWebImageRefreshCached];



    NSURL * imageURL2 = [NSURL URLWithString:[[_jsonArray objectAtIndex:indexPath.row] valueForKey:@"image"]];


    [cell.profileImage setImageWithURL:imageURL2

                      placeholderImage:[UIImage imageNamed:@"image"]

                            options:SDWebImageRefreshCached];



    return cell;

}
Run Code Online (Sandbox Code Playgroud)

那是我的CarTableViewCell.h:

#import <UIKit/UIKit.h>



@interface CarTableViewCell : UITableViewCell



@property (nonatomic, strong) IBOutlet UIImageView *carImage;

@property (nonatomic, strong) IBOutlet UILabel *makeLabel;

@property (nonatomic, strong) IBOutlet UILabel *modelLabel;



@property (nonatomic, strong) IBOutlet UILabel *likes;

@property (nonatomic, strong) IBOutlet UILabel *comments;

@property (nonatomic, strong) IBOutlet UILabel *username;

@property (nonatomic, strong) IBOutlet UILabel *refuser;

@property (nonatomic, strong) IBOutlet UIImageView *profileImage;



@end
Run Code Online (Sandbox Code Playgroud)

提前致谢.

l0g*_*g3r 5

你需要打电话

[cell.carImage sd_setImageWithURL:imageURL
                 placeholderImage:[UIImage imageNamed:@"placeholder.png"]
                          options:SDWebImageRefreshCached];
Run Code Online (Sandbox Code Playgroud)