简体   繁体   English

将Tap Gesture添加到表格视图中将使放置在表格标题视图中的UICollectionView单元格无法选择

[英]Adding tap Gesture to a tableview makes the UICollectionView cells not selectable which are placed in the table header view

I have a tap gesture added to a table view for dismissing the keyboard. 我有一个点击手势添加到表格视图中以关闭键盘。 In order to make multiple gesture recognizing i have implemented gesture delegation. 为了进行多个手势识别,我已经实现了手势委托。 Every thing works fine. 一切正常。 I am able to receive tap gestures and button touch gestures which are place in header view simultaneosly. 我能够同时接收在标题视图中放置的轻击手势和按钮触摸手势。

But the collection view cell in the header is not selectable because of my tap gesture in the table view. 但是由于我在表格视图中点击手势,标题中的集合视图单元格无法选择。 Can any one help me on this 谁可以帮我这个事

这应该可以解决问题[tap setCancelsTouchesInView:NO];

I know this is an old question, but I just came up with this exact problem and found a kind of solution. 我知道这是一个老问题,但我只是想出了这个确切的问题,并找到了一种解决方案。

So first, remove the tap gestures. 因此,首先,请删除点击手势。 Next, in didSelectRowAtIndexPath add the following: 接下来,在didSelectRowAtIndexPath添加以下内容:

[self.view endEditing:YES];

And there you should have it. 在那儿,你应该拥有它。

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

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