dre_84w934
dre_84w934

Reputation: 738

return tableView didSelectRowAt while cell's content view user interaction is enabled

I have made a custom xib UITableViewCell with a UIButton inside. The contentView within the cell has, and must have .isUserInteractionEnabled = True. The problem I am facing is that when using

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

of UITableView the function does not get called. I have read that for some reason I cannot have didSelectRowAt working while contentView.isUserInteractionEnabled = True. It's either one or the other type of deal. However, in my situation, I must have contentView.isUserInteractionEnabled = True and didSelectRowAt working. So what is a good workaround for this problem?

I already have :

tableView.dataSource = self
tableView.delegate = self

Upvotes: 1

Views: 175

Answers (0)

Related Questions