Ios 将数据从自定义tableview单元格传递到UIView控制器
下面是[blog][1],用于将数据从表视图中的自定义单元格传递到视图控制器。自定义单元格正在从响应中获取数据,我必须在自定义单元格中显示部分数据,在详细视图控制器中显示其余数据。有人能确定我的代码中的实际问题在哪里吗?从segue传递数据Ios 将数据从自定义tableview单元格传递到UIView控制器,ios,objective-c,uitableview,didselectrowatindexpath,Ios,Objective C,Uitableview,Didselectrowatindexpath,下面是[blog][1],用于将数据从表视图中的自定义单元格传递到视图控制器。自定义单元格正在从响应中获取数据,我必须在自定义单元格中显示部分数据,在详细视图控制器中显示其余数据。有人能确定我的代码中的实际问题在哪里吗?从segue传递数据 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.identifier isEqualToString:@"ShowDetail
- (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中的属性,因为destViewController.Idss(颜色显示错误)
@property(nonatomic,strong) NSString *Idss; // Make as this and
@synthesize Idss
并更改[\u Id objectAtIndex:indexath.row]//将_Id数组名称替换为另一个名称您可能已经删除了从
情节提要
到视图控制器的连接
@property(nonatomic,strong) NSString *Idss; // Make as this and
@synthesize Idss
请检查您的插座是否连接正确。⚠️
在您的showViewController
中,必须首先创建并删除id
属性,您当前的输出是什么?您如何在showViewController中声明ids?随机指定一个名称以访问值@AravindARno您可能已经在ShowViewController中声明了IDS,只需显示其代码您已经从ShowViewController中删除了任何插座,检查插座是否正确在进行更改后设置相同的错误。@Lalit Kumari已经编辑了我的问题并添加了屏幕截图,请将其签出。@Lalit Kumaris现在向我显示此错误,-[StringData length]:发送到实例0x60800138B00 2017-07-03 15:41:20.922 PK.House[10411:854053]***由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:'-[StringData length]:发送到实例0x6080013B00'的未识别选择器ShowViewController
,在此显示您的代码,您现在可以检查ViewDidLoad是否正在调用您的ShowViewController