2017-07-03 59 views
1

我以下這個[博客] [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

enter image description here

+0

什麼是你的電流輸出? –

+0

你如何在ShowViewController中聲明Idss? –

+0

隨機給予訪問值的名稱。 @AravindAR –

回答

2

你可能已經刪除您outlet連接您ViewController 請檢查您的插座正確或不連接。 ⚠️

enter image description here

必須有一個id財產首先創建和刪除,在你showViewController

+0

它現在向我顯示此錯誤, - [StringData length]:無法識別選擇器發送到實例0x608000138b00 2017-07-03 15:41:20.922 PK.House [10411:854053] ***因未捕獲異常'NSInvalidArgumentException'而終止應用程序,原因:' - [StringData length]:無法識別的選擇器已發送到實例0x608000138b00' –

+0

'ShowViewController'在此顯示你的代碼,你現在可以檢查你的ViewDidLoad正在調用你的'ShowViewController' – Dhiru

0

檢查屬性,因爲destViewController.Idss(顏色顯示錯誤)

@property(nonatomic,strong) NSString *Idss; // Make as this and 
@synthesize Idss 

,改變[_id objectAtIndex:indexPath.row] //替換_id數組名與另一名

+0

更改後出現同樣的錯誤@ Lalit kumar –

+0

顯示您的更改代碼 –

+0

我編輯了我的問題並添加了屏幕截圖,查看它。@ Lalit kumar –

相關問題