UIButton not responding used in a custom UITableViewCell

后端 未结 6 1494
感动是毒
感动是毒 2020-12-20 19:29

I know this issue is already been asked few times in SO. Despite trying those out, I am still unable to solve my problem.

I am using a UITableView inside a UIViewCo

6条回答
  •  醉酒成梦
    2020-12-20 19:57

    I faced a similar issue. I was programmatically adding an UIButton to the UITableViewCell via addSubview. The button would not respond to touch events. Using Debug View Hierarchy, I finally discovered that any subviews added to the UITableViewCell was behind contentView, which was blocking user input from reaching the UIButton. The issue was resolved by adding the UIButton to contentView instead of the UITableViewCell.

提交回复
热议问题