Swift 如何在多个单元格中选择Rowat?

Swift 如何在多个单元格中选择Rowat?,swift,swift3,Swift,Swift3,我将粘贴一些代码 func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { if menu == "your_products"{ let cell = tableView.dequeueReusableCell(withIdentifier: "VendorTableViewCellId", for: indexPath as

我将粘贴一些代码

 func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    if menu == "your_products"{
        let cell = tableView.dequeueReusableCell(withIdentifier: "VendorTableViewCellId", for: indexPath as IndexPath) as! VendorTableViewCell
        let vendor = self.vendors![indexPath.row]
        cell.setVendor(vendor: vendor)
        return cell
    }else{
        let cell = tableView.dequeueReusableCell(withIdentifier: "EventTableViewCellId", for: indexPath as IndexPath) as! EventTableViewCell
        cell.setEvent(event: self.events![indexPath.row])
        return cell
    }
}
如何在多个单元格中使用indexPath.section和indexPath.row,通过最后一个函数didSelectRowAtIndexPath访问每一节和每一行

 func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {

    self.tableView.deselectRow(at: indexPath as IndexPath, animated: false)
   print("You tapped cell number \(indexPath.row).")
}

删除此行
self.tableView.deselectRow(at:indepath作为indepath,动画:false)

我认为应该行得通。
如果这不起作用,请检查您的学员是否已连接

当我点击单元格时,结果不是there@IrwanMadness现在checkI已选中,但未得到任何结果:(打印语句将仅在控制台中显示。请选中控制台检查您的UITableView选择属性不应为none。
 @objc func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)
        {
            print(indexPath.row)
            print(indexPath.section)
       }
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    print("You tapped cell number \(indexPath.row).")    
}