【发布时间】:2017-08-18 06:07:51
【问题描述】:
我创建了一个 UITableView 并将其连接到数据源并委托故事板并将 UITableViewDelegate、UITableViewDataSource 放在课堂上。当然还有UINavigationControllerDelegate 推送到另一个UIViewcontroller。
我打过电话
self.tableView.dataSource = self
self.tableView.delegate = self
在viewDidLoad.
这是我的didSelectRowAtIndexpPath: 代码:
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
//let cell = tableView.dequeueReusableCellWithIdentifier(reuseContentFreeIdentifier, forIndexPath: indexPath) as! FreeTableViewCell
print("didSelectRowAtIndexPath eshops")
let row = indexPath.row
print("business row:\(HCPartner[row])")
performSegue(withIdentifier: "eshopsURL", sender: self)
}
当我点击一个单元格行时,它没有检测到任何点击,也没有显示任何print("didSelectRowAtIndexPath eshops") 的日志。
为什么didSelectRowAtIndexPath: 不起作用?我在 swift 2 上试过,效果很好。但在 swift 3 中它不起作用。
我的代码有什么问题?什么是让它检测点击UITableView的单元格行的正确代码?
【问题讨论】:
-
你能贴一张你的单元格视图层次结构的图片吗?
-
已经更新了单元格视图层次结构的图像
-
打开您的单元格视图层次结构以查看您的单元格内的内容,如果我不够清楚,请见谅
-
更新已发送的有问题的图片
-
您的 tableView 显示您的数据?只是缺少选择?
标签: ios uitableview swift3