我的桌面 View 在按下时没有反应。
当我添加时:
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
print("section: \(indexPath.section)")
print("row: \(indexPath.row)")
}
它首先在首次加载时打印表格 View 中的所有行和部分,然后再按任何内容。但是在我删除该代码并再次添加它之后,它根本不打印任何内容,即使当我按下单元格时也不打印任何内容。
有人遇到过这种情况吗?
最佳答案
如果你的编译器没有显示,也许你只是之前缺少覆盖。
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
print("section: \(indexPath.section)")
print("row: \(indexPath.row)")
}
关于swift - tableView 中的单元格在按下时没有反应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48298129/