其他分享
首页 > 其他分享> > tableview加tap手势,cell点击无效了

tableview加tap手势,cell点击无效了

作者:互联网

需求:点击空白收起筛选table

我在view加了tap手势, 点击空白,确实可以收起下拉筛选了,但是点击大table的cell不能跳转了!!!

`__weak typeof(self)weakSelf = self;

UITapGestureRecognizer *tableTap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id  _Nonnull sender) {
    [weakSelf foldHeaders];
}];
[self.view addGestureRecognizer:tableTap];`

设置cancelsTouchesInView这个属性就行了
__weak typeof(self)weakSelf = self;

UITapGestureRecognizer *tableTap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id  _Nonnull sender) {
    [weakSelf foldHeaders];
}];
tableTap.cancelsTouchesInView = NO;
[self.view addGestureRecognizer:tableTap];``

标签:tap,tableview,self,weakSelf,cell,点击,tableTap,UITapGestureRecognizer,view
来源: https://www.cnblogs.com/tufei7/p/15954798.html