![](/img/trans.png)
[英]Touch events in a subview of a UITableViewCell of a static UITableView
[英]UITableView inside UITableViewCell not receiving touch events
所以我有一个嵌套在UITableViewCell中的UITableView,例如:
UITableView baseTable
UITableViewCell baseTableCell0
UITableViewCell baseTableCell1
subView连接了一个UITapGestureRecognizer,就像按钮一样,subTableView和subCollectionView应该接收触摸事件并执行didSelectRowAtIndexPath
在iOS 8上,它工作正常,但是当我在ios 7上进行测试时,subTableView和subCollectionView中的单元格不再接收触摸事件,触摸事件将发送到[baseTableView tableview ... didSelectRowAtIndexPath]。 但是,subView上的UITapGestureRecognizer仍可以接收触摸事件。
在标签手势对象上使用此代码
tap.cancelsTouchesInView = NO;
尝试更改UITableView,UITableViewCell和UIView的背景颜色,这样您就可以查看子视图是否未超出父视图,如果子视图不会接收触摸事件。 然后,调整“父级”以完全显示子级,或者调整子级以保留在父级边界中。
希望能帮助到你!
编辑:
将触摸事件传递给子视图可能会有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.