1

我制作了一个UITableViewCell带有UIButton内部的自定义 xib。单元格contentView内有,而且必须有.isUserInteractionEnabled = True。我面临的问题是使用时

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        print("selected row at index: \(indexPath)")
 }

UITableView函数不会被调用。我已经读过,由于某种原因,我不能didSelectRowAtcontentView.isUserInteractionEnabled = True. 这是一种或另一种类型的交易。但是,在我的情况下,我必须有contentView.isUserInteractionEnabled = TruedidSelectRowAt工作。那么对于这个问题有什么好的解决方法呢?

我已经有了 :

tableView.dataSource = self
tableView.delegate = self
4

0 回答 0