我知道,在stackoverflow.com是很多類似的問題,但我沒有找到我的問題的答案! 當我建立我的項目時,我得到一個錯誤Use of undeclared identifier cellForRowAtIndexPath
但它是一種方法。 我真的需要申報嗎?什麼是錯的?使用未聲明的標識符「cellForRowAtIndexPath」
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
self.selectedRow = [[[tableView: cellForRowAtIndexPath:indexPath] textLabel] text];
}
謝謝。
你可以添加任何你想要的類的方法。您不需要遵守協議,也不需要將該類設置爲委託即可添加方法。此外,問題在於,OP只是嘗試調用現有方法時使用了所有錯誤的語法。 – rmaddy
你不能在沒有聲明它的情況下添加任何你想要的類的方法,或者在其他地方聲明該方法的情況下將該類作爲委託。 – MystikSpiral
是的,我將這種方法添加到.m文件和numberOfRowsInSection包括。在這裏我嘗試使用它的方法來將數據從單元格粘貼到指針。 – Vladimir