在没有 UIButton 的情况下单击时 UITableViewCell 不起作用

UITableViewCell not work when clicked without UIButton

单击时我正在处理 tableviewcell。当我点击单元格时它不会工作,我不想使用 UIButton 因为高度混乱了。这是我的代码

cell.accessibilityIdentifier = "\(indexPath.section)"
cell.tag = indexPath.row
cell.target(forAction: #selector(reminderClicked), withSender: self)

@objc func reminderClicked(_ sender: UITableViewCell) {
   print("\(sender.tag) - \(String(describing: Int(sender.accessibilityIdentifier ?? "0")))")
}

有什么想法吗?

有一个 TableViewDelegate 函数可用于检查单元格上的点击。

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