Dan*_*e B 5 uitableview didselectrowatindexpath ios swift
我UIView在一个里面放了一个小的UITableViewCell。
UIView,我想打开一个弹出窗口。UIView点击,我想执行UITableView“ didSelectRowAtIndexPath ”函数中定义的操作。目前发生的情况是,当我单击视图时,会发生两件事:打开弹出窗口并触发“ didSelectRowAtIndexPath ”函数。
如何确保当我单击时不会触发UIView“ didSelectRowAtIndexPath ”函数?
目前的实施:
我在自定义类中UITapGestureRecognizer定义了一个。UIViewUITableViewCell
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(MyCustomTableViewCell.clickOnHelp(_:)))
myClickAreaUIView.addGestureRecognizer(tapGesture)
我建议的最佳解决方案是将 更改UIView为 a并使用按钮上的UIButtona 处理触摸。touchUpInside
这样您就可以达到您的目标,因为UIButton自动阻止触摸事件转发到超级视图
| 归档时间: |
|
| 查看次数: |
621 次 |
| 最近记录: |