【发布时间】:2014-11-12 05:11:49
【问题描述】:
下午好,
我正在尝试在我的 TableViewController 中实现 SDWebImage,但由于我的 UiImageView 导致我无法检测到问题,我遇到了一些错误,我需要一些帮助。我希望你能找到一些东西,因为我现在迷路了。
我收到以下错误:
“UIImageView”没有可见的@interface 声明选择器“sd_setImageWithURL:placeholderImage:”
应用程序运行正常,缓存运行正常,但我收到了该错误。
如果我已经将“carImage”设置为 UIImageView,为什么会发生此错误?我该如何解决?
CarTableViewController.m
- (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"]];
NSData * imageData = [NSData dataWithContentsOfURL:imageURL];
UIImage * carPhoto = [UIImage imageWithData:imageData];
// ERROR [cell.carImage sd_setImageWithURL:imageURL placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
NSURL * imageURL2 = [NSURL URLWithString:[[_jsonArray objectAtIndex:indexPath.row] valueForKey:@"image"]];
NSData * imageData2 = [NSData dataWithContentsOfURL:imageURL2];
UIImage * carPhoto2 = [UIImage imageWithData:imageData2];
cell.profileImage.image = carPhoto2;
return cell;
}
这是我的 CarTableViewCell.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
提前致谢。
【问题讨论】:
-
您能检查一下库搜索路径...还是框架搜索路径?您的 Project + Target + TestSuite 构建设置都指向 SDWebImageFramework 吗?我记得上次我错过了我的 TestSuite 框架的路径,它抱怨找不到框架。
标签: ios xcode uitableview xcode6 sdwebimage