【发布时间】:2017-07-03 10:03:14
【问题描述】:
我正在关注这个 [博客][1],用于将数据从表格视图中的自定义单元格传递到视图控制器。自定义单元格正在从响应中获取数据,我必须在自定义单元格中显示其中的一些数据,而在详细视图控制器中显示其余数据。谁能确定我的代码中实际问题出在哪里?从 segue 传递数据。
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:@"ShowDetail"]) {
//Do something
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
ShowViewController *destViewController = segue.destinationViewController;
destViewController.tites = [_Title objectAtIndex:indexPath.row];
destViewController.prce = [_Price objectAtIndex:indexPath.row];
destViewController.ara = [_LandArea objectAtIndex:indexPath.row];
destViewController.phon = [_Phone objectAtIndex:indexPath.row];
destViewController.citi = [_City objectAtIndex:indexPath.row];
destViewController.loc = [_location objectAtIndex:indexPath.row];
destViewController.tye = [_type objectAtIndex:indexPath.row];
destViewController.Idss = [_Id objectAtIndex:indexPath.row];
destViewController.nam = [_name objectAtIndex:indexPath.row];
destViewController.emal = [_email objectAtIndex:indexPath.row];
destViewController.roomss = [_rooms objectAtIndex:indexPath.row];
destViewController.wash = [_washroom objectAtIndex:indexPath.row];
destViewController.flloors = [_floor objectAtIndex:indexPath.row];
destViewController.stat = [_status objectAtIndex:indexPath.row];
destViewController.descrp = [_descrip objectAtIndex:indexPath.row];
destViewController.countryy = [_country objectAtIndex:indexPath.row];
}
}
这是我单击单元格时遇到的错误。
由于未捕获的异常“NSUnknownKeyException”而终止应用程序, 原因: '[ setValue:forUndefinedKey:]:这个类不是键值 符合密钥 ID 的编码。首先抛出调用栈:
这是我的ShowViewcontroller.h 文件。
更改代码。
【问题讨论】:
-
你当前的输出是什么?
-
你是如何在 ShowViewController 中声明 Idss 的?
-
随机指定一个名称来访问值。 @AravindAR
-
不,你可能在 ShowViewController 中声明了 Idss,只是显示它的代码
-
您已经从 ShowViewController 中删除了任何 Outlet,请正确检查 outlet
标签: ios objective-c uitableview didselectrowatindexpath