繁体   English   中英

图片问题

[英]trouble with images

我在运行时遇到问题,说

-[__ 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的视图时发生此错误。 如果我需要提供更多信息,请不要犹豫告诉我。

似乎您要在此处返回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的问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM