我在运行时遇到问题
- [__ NSCFString _isResizable]:无法识别的选择器发送到实例0x6a86a80 2012-10-24 14:21:08.070糖尿病食物指南[767:c07] * 由于未捕获的异常'NSInvalidArgumentException'终止应用程序,原因:' - [__ NSCFString _isResizable]:发送到实例的无法识别的选择器0x6a86a80'
我认为问题出在代码的这些部分:
/*ViewControllerManual.m*/
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
NSDictionary* tier = (NSDictionary*)sender;
if ([segue.identifier isEqualToString:@"loopbackSegue"]) {
ViewControllerManual* nextController = segue.destinationViewController;
nextController.items = [tier objectForKey:@"items"];
nextController.title = [tier objectForKey:@"name"];
} else if ([segue.identifier isEqualToString:@"detailSegue"]) {
DetailsController* nextController = segue.destinationViewController;
nextController.name = [tier objectForKey:@"name"];
nextController.foodPicture = [tier objectForKey:@"foodPicture"];
nextController.tablePicture = [tier objectForKey:@"tablePicture"];
}
}
/*DetailsController.m*/
- (void)viewDidLoad {
[super viewDidLoad];
nameLbl.text = self.name;
foodPic.image = self.foodPicture;
tablePic.image = self.tablePicture;
}
foodPic和tablePic都是UIImageViews,而foodPic是使用cell.imageView.image = [UIImage imageNamed:[[self.items objectAtIndex:indexPath.row] objectForKey:@"foodPicture"]];
设置的
从包含图像路径的数组调用。只有在加载DetailsController类的视图时才会出现此错误。
如果我需要提供更多信息,请不要犹豫告诉我。
答案 0 :(得分:0)
似乎你在这里返回NSStrings:
nextController.foodPicture = [tier objectForKey:@"foodPicture"];
nextController.tablePicture = [tier objectForKey:@"tablePicture"];
然后
// UIImage* = NSString*
nextController.foodPicture = [tier objectForKey:@"foodPicture"];
nextController.tablePicture = [tier objectForKey:@"tablePicture"];
或者你已经发布了一些东西。但是从你的描述来看,更有可能是将NSString分配给UIImage的问题。