Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

自定义的视图如果是tableView cell无法点击 #54

Open
zjinhu opened this issue Oct 15, 2019 · 2 comments
Open

自定义的视图如果是tableView cell无法点击 #54

zjinhu opened this issue Oct 15, 2019 · 2 comments

Comments

@zjinhu
Copy link

zjinhu commented Oct 15, 2019

自定义的视图emptyViewWithCustomView如果是tableView ,tableView的cell点击事件不走代理方法

@zjinhu
Copy link
Author

zjinhu commented Oct 15, 2019

问题出在LYEmptyBaseView
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapEmptyView:)];
[self addGestureRecognizer:tap];

应该改为
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapEmptyView:)];
tap.delegate = (id)self;
[self addGestureRecognizer:tap];
并添加代理方法

  • (BOOL)gestureRecognizer:( UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:( UITouch *)touch {
    if ([NSStringFromClass([touch.view class]) isEqualToString:@"UITableViewCellContentView"]) {
    return NO;
    }
    return YES;
    }

@isdotjim
Copy link

搭个车...
想邀请Repo作者来w3c.group创建项目的对应小组。w3c.group是类似知识星球的社群工具,小组可设置为付费且有赞助功能,同时也是一个区块链主导的创作者社区。这是相关介绍:
http://t.cn/Ai1vLcCU
http://t.cn/Ai1vLcCG
http://t.cn/Ai1vLcCA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants