gpt4 book ai didi

ios - UITableViewCell 只接受长按

转载 作者:行者123 更新时间:2023-11-29 02:47:02 24 4
gpt4 key购买 nike

遇到 UITableViewCell 的问题。我试图获取所选 UITableViewCell 的数据。最初它运行良好,但在 UITapGestureRecognizer 之后它会带来麻烦。我使用的表格被分配给一个 subview ,即使很少有按钮在​​第一次点击时没有采取行动。在添加 UITapGestureRecognizer 之后,我正面临这个问题。

tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self
action:@selector(didTapAnywhere:)];
[tapRecognizer setNumberOfTapsRequired:1];
[tapRecognizer setNumberOfTouchesRequired:1];
[self.view addGestureRecognizer:tapRecognizer];
[self.scrolling addGestureRecognizer:tapRecognizer];
[self.notesView addGestureRecognizer:tapRecognizer];

-(void)didTapAnywhere: (UITapGestureRecognizer*) recognizer {

[ageview removeFromSuperview];
[contiView removeFromSuperview];
[CountryTableview removeFromSuperview];
[notesView endEditing:YES];
[self.view endEditing:YES];
}

最佳答案

您的点击手势正在取消对单元格和按钮的触摸手势,请确保您分配点击手势的 View 不会与按钮重叠,否则会导致触摸事件取消

关于ios - UITableViewCell 只接受长按,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24988996/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com