我有一個自定義UITableView
在ViewController
。我的自定義表有自定義UITableViewCells
。這是我ViewController
裏面的代碼:UITableView didSelectRowAt不註冊
ViewDidLoad
:
self.firstListTable.dataSource = self
self.firstListTable.delegate = self
self.firstListTable.register(UINib(nibName: "firstQueueCell", bundle: Bundle.main), forCellReuseIdentifier: "firstCell")
self.searchListTable.dataSource = self
self.searchListTable.delegate = self
self.searchListTable.allowsSelection = true
self.searchListTable.register(UINib(nibName: "SearchCell", bundle: Bundle.main), forCellReuseIdentifier: "SearchCell")
self.searchListTable.separatorStyle = .none
UITableViewFunctions
:
func tableView(_ tableView: UITableView, didHighlightRowAt indexPath: IndexPath) {
if tableView == self.searchListTable {
print("hello")
}
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath){
print("hello")
}
didHighlightRowAt
作品,但didSelectRowAt
沒有。
我嘗試這樣做: didSelectRowAtIndexPath: not being called
什麼其他原因可能有多大?
謝謝!
看起來你的代碼沒有錯誤,你可以發佈所有關於它的代碼讓我們看看如果是其他地方出錯了嗎? – aircraft
@ user82395214,檢查你的代碼。它沒有錯。他們都在迴應。你可以把'print('hello)'''''''''''''''print'語句更改爲不同的東西,然後再次檢查它嗎? – KrishnaCA