gpt4 book ai didi

xcode - UITapGestureRecognizer 与 didSelectRowAtIndexPath 冲突

转载 作者:搜寻专家 更新时间:2023-10-31 08:20:33 27 4
gpt4 key购买 nike

在我问这个问题之前我尝试了其他解决方案但它没有用

这是我的代码

override func viewDidLoad() {
super.viewDidLoad()

let tapGesture = UITapGestureRecognizer(target: self, action: "didTouchBoard:")
view.addGestureRecognizer(tapGesture)
tapGesture.cancelsTouchesInView = true
}

当我点击任何地方它会隐藏键盘(如果存在),但如果我点击 tableviewcell 或 collectionviewcell,它不会点击

我尝试了这个 tapGesture.cancelsTouchesInView ,但没有用

最佳答案

如果你想让table view接收触摸,那就改tapGesture.cancelsTouchesInView

tapGesture.cancelsTouchesInView = false

关于xcode - UITapGestureRecognizer 与 didSelectRowAtIndexPath 冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35937002/

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