简体   繁体   English

禁用了用户交互的UITableViewCell和UITextField不会调用didSelectRow

[英]UITableViewCell and UITextField with user interaction disabled doesn't call didSelectRow

My cell has a UITextField (bound to all the edges) with isUserInteractionEnabled on false. 我的单元格有一个UITextField (绑定到所有边缘),其中isUserInteractionEnabled为false。 So I expect that when I click the cell the didSelectRowAt is called. 所以我希望当我单击单元格时, didSelectRowAt被调用。

Nowm this never happens. Nowm这永远不会发生。 It doesn't call the didSelectRowAt function. 它不调用didSelectRowAt函数。

Is there any way to find out who is consuming my event? 有什么办法找出谁在消耗我的活动? Also in the view debugger, I don't see any views on top of it. 同样在视图调试器中,我没有在其上面看到任何视图。

  • Make sure your VC is delegate of UITableView 确保您的VC是UITableView的委托
  • Make sure your tableView selection is not "No Selection" 确保您的tableView选择不是“ No Selection”
  • And final, try to use 最后,尝试使用

    textfield.isEnable = false instead of textfield.isUserInteractionEnable = false textfield.isEnable = false而不是textfield.isUserInteractionEnable = false

  • Make sure you implemented UITableViewDelegate. 确保实现了UITableViewDelegate。
  • Make sure you have not added UITapGestureRecognizer anywhere in your view. 确保没有在视图中的任何位置添加UITapGestureRecognizer。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM