简体   繁体   English

UITableView不会将触摸传递到自定义行的控件中,而是选择行

[英]UITableView doesn't pass touches through into custom row's controls, it selects row instead

I set up a UITableView with custom cells but I have found that UITableView, when I first tap it, wants to select the row. 我用自定义单元格设置了一个UITableView,但是我发现UITableView第一次选择时要选择该行。 Whereas I want to tap what's in each cell. 而我想点击每个单元格中的内容。

Is there a way to tell UITableView to enter a mode where row selection does not occur? 有没有办法告诉UITableView进入不进行行选择的模式?

Thanks. 谢谢。

UITableViewCell is a subclass of UIView so it has the property userInteractionEnabled which you can set to NO when you create each cell. UITableViewCellUIView的子类,因此它具有属性userInteractionEnabled ,您可以在创建每个单元格时将其设置为NO。

userInteractionEnabled userInteractionEnabled

A Boolean value that determines whether user events are ignored and removed from the event queue. 一个布尔值,该值确定是否忽略用户事件并将其从事件队列中删除。 When set to NO, user events—such as touch and keyboard—intended for the view are ignored and removed from the event queue. 设置为NO时,将忽略视图的用户事件(例如触摸和键盘)并将其从事件队列中删除。 When set to YES, events are delivered to the view normally. 设置为YES时,事件将正常传递到视图。 The default value is YES. 默认值为是。

Not sure if 'removed from the event queue' means the cell contents won't receive the touch response either. 不知道“从事件队列中删除”是否意味着单元格内容也不会收到触摸响应。

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

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