Objective c 如何使用属性列表字符串填充UIImageView
我正在尝试将图像从plist加载到自定义单元格。 标签可以很好地使用,但是当我使用imageview运行应用程序时,它崩溃了 第h单元:Objective c 如何使用属性列表字符串填充UIImageView,objective-c,xcode,uiimageview,plist,Objective C,Xcode,Uiimageview,Plist,我正在尝试将图像从plist加载到自定义单元格。 标签可以很好地使用,但是当我使用imageview运行应用程序时,它崩溃了 第h单元: @interface WineCell : UITableViewCell @property (nonatomic, strong) IBOutlet UILabel *nameLabel; @property (nonatomic, strong) IBOutlet UIImageView *bottleImageView; @end ViewCon
@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 Appen[3862:f803]无法加载从捆绑包中具有标识符“NOVAFORLAG.R-dvinsguiden”的笔尖引用的“瓶子”图像
2012-06-20 01:41:08.978 Rødvinsguiden[3862:f803]-[uu_NSCFString_isResizable]:发送到实例0x6d7b800的未识别选择器
cell.bottleImageView.image = [UIImage imageNamed:[[wine libraryItemAtIndex:indexPath.row] valueForKey:@"Image"]];
因为plist文件只能存储图像的名称。或者您可以对图像进行编码并将其作为NSData放入其中(但肯定不是最好的方法)。