我以下這個[博客] [1],用於在表視圖從自定義單元格將數據傳遞到一個視圖控制器。自定義單元格正在從響應中獲取數據,我必須在「自定義單元格」和「詳細信息視圖控制器」中的其餘數據中顯示它。任何人都可以確定實際問題出現在我的代碼中嗎?傳遞來自segue的數據。從定製的tableview細胞將數據傳遞到控制器的UIView
- (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
什麼是你的電流輸出? –
你如何在ShowViewController中聲明Idss? –
隨機給予訪問值的名稱。 @AravindAR –