我正在尝试将图像从plist加载到自定义单元格。标签一切正常,但是当我使用 imageview 运行应用程序时,它会崩溃。
单元格:
@interface WineCell : UITableViewCell
@property (nonatomic, strong) IBOutlet UILabel *nameLabel;
@property (nonatomic, strong) IBOutlet UIImageView *bottleImageView;
@end
ViewController.m:
cell.nameLabel.text = [[wine libraryItemAtIndex:indexPath.row] valueForKey:@"Name"];
cell.bottleImageView.image = [[wine libraryItemAtIndex:indexPath.row] valueForKey:@"Image"];
崩溃报告:
2012-06-20 01:41:08.975 澳鹏[3862:f803] 无法加载从捆绑包中的笔尖引用的"瓶子"图像,标识符为"NOVAFORLAG.R-dvinsguiden"2012-06-20 01:41:08.978 Rødvinsguiden[3862:f803] -[__NSCFString _isResizable]:无法识别的选择器发送到实例0x6d7b800
尝试
cell.bottleImageView.image = [UIImage imageNamed:[[wine libraryItemAtIndex:indexPath.row] valueForKey:@"Image"]];
因为 plist 文件只能存储图像的名称。