2013-02-22 63 views
-1

我的問題是,當我在我的表點擊查看返回該錯誤didSelectRowAtIndexPath方法:(NSIndexPath *)indexPath返回錯誤的指數

2013-02-22 11:22:42.293 Exercise[1570:c07] -[NSIndexPath item]: unrecognized selector sent to instance 0x6e7ddd0 

2013年2月22日11:22:42.294練習[1570: C07] *

,這是它返回錯誤的指數

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ 
    NSLog(@"uitable index: %ld",(long)indexPath.item); 

DBHelper *dataObj = [appDelegate.dataArray objectAtIndex:indexPath.row]; 
self.selIndex = indexPath.item; 
LblID = dataObj.dataID; 
VCFname.text = dataObj.DBFirstName; 
VCLname.text = dataObj.DBLastName; 
VCMobile.text = dataObj.DBMobile; 
VCEmail.text = dataObj.DBEmail; 
VCBday.text = dataObj.DBBirthdate; 

NSLog(@"dataID:%i dataArrayCount:%i",self.selIndex,appDelegate.dataArray.count); 

}

我已將表視圖的委託和數據源連接到文件所有者。

編輯:附加信息 我想從我的SQLite數據庫中的數據,以顯示在文本框時,我在tableview中

+1

請看'NSIndexPath'的文檔。沒有'item'屬性或方法。你想要得到什麼? – rmaddy 2013-02-22 03:39:58

+0

我想從我的數據庫中獲取數據以顯示在我的文本字段 – user2093735 2013-02-22 03:45:33

+0

對不起,我的意思是你試圖從'indexPath'中嘗試使用'item'? – rmaddy 2013-02-22 03:46:27

回答

0

item屬性聲明在UICollectionView.h不在UITableView.h。你可以看到item。在tableView中,你應該使用indexPath.section

+0

'item'不是'UICollectionView'的一部分,它是從iOS 6.0開始的'NSIndexPath'的一個新屬性。 – rmaddy 2013-02-22 03:50:08

+0

@rmaddy我不說項目是UICollectionView的一部分,在UICollectionView.h中聲明瞭一個所述項目,查看項目 – 2013-02-22 03:51:47

+0

的擴展鏈接我剛來更新我的評論。 'item'是碰巧在'UICollectionView.h'中聲明的'NSIndexPath'類別的一部分。對困惑感到抱歉。 – rmaddy 2013-02-22 03:52:39

相關問題